Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115655 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 77011 invoked from network); 7 Aug 2021 17:28:00 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Aug 2021 17:28:00 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7EA321804AA for ; Sat, 7 Aug 2021 10:57:47 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: * X-Spam-Status: No, score=1.8 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,URIBL_SBL,URIBL_SBL_A autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 7 Aug 2021 10:57:47 -0700 (PDT) Received: by mail-pj1-f45.google.com with SMTP id nh14so21501980pjb.2 for ; Sat, 07 Aug 2021 10:57:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=bKjwSUXfasuqgJiyP5cQsrgdGyGWvGDxmA++7gEUXag=; b=pv2W+hgUBQX+e3hNZKF/nexrFrzlKnbP8n9pTtYK4o69Z3oIGxpiD02ME9pL+V1y6d i3IV/kCg66v0ZDJe8+P0S8/u75yDfvxWBiFuer7gxlWP33QITkEEjHyE05tJW7MLY+bc rguDzk5nA3+911oE7FuahowqXtHy35Zs35i3q991ZxvQ9CQfEyVaJkL/SAz0KUlncyeH aI7wzRq3bO2IuN4J8KM4+DVthmEeapg/hCHW9jjjmvWtrJZEPAA07gdjXEuvUzpYd9PW hqgWVknDg+ecQ8pjZ8kfpnSTgFQ0czq4K+F8RZ+MzOPryppDfSwB1RcAyhujpP/e8kr+ c+6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=bKjwSUXfasuqgJiyP5cQsrgdGyGWvGDxmA++7gEUXag=; b=OsWuJm921LtKq7XK+pWg/eqCf5C/GmaxZDZX+jzuhUuDRlrkhBfJz48VwxMSIGOyvF UC1B37LLxDuc/VRY8CT+Q9C/UJJdqdUyDBcwJAZTG7b8giGfKjs9GeNxOnwslfsAhLX5 rE8k7j8/MBIjYR3JDZFJOkaDo/Mqxxnq3OeBl1NBXp2FiS/H6I1Sp2+eBRpufMZ/B0ib 7Y7iOJIaRUBHYq5cjd+VFaNbR5mNlNAR08H/by+2U2cJwEjCE6UhoQhKJF25zZa3eiMG CQZck7eBBFDlFH+B066AMOkjMrTTyw2c56e/ToGX82agLZbw3miJlp5G/WS10gYJVZqo Heug== X-Gm-Message-State: AOAM531Qm9d/2HZeUj5UvvHWqzG4PAfWp+gtj5nQCQMx/SY+AJG34x1Q 7g/pr7Yj/knuYsGa4n+DHDbxL0vsBpaBTrzpsjtX4zTEVhLmDQ== X-Google-Smtp-Source: ABdhPJzeb8Qi6Nd47Tpp6S0fQ+ITpes4FSQmMqSwE23yYsH6oVQHgEVv9PwwB0g17Xf9OVnZ9RXSpJAjTb+OZTrxyEY= X-Received: by 2002:a63:5505:: with SMTP id j5mr95628pgb.250.1628359064115; Sat, 07 Aug 2021 10:57:44 -0700 (PDT) MIME-Version: 1.0 Date: Sat, 7 Aug 2021 19:57:08 +0200 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000955e2705c8fbe3ff" Subject: mb_check_encoding slow performance? From: divinity76@gmail.com (Hans Henrik Bergan) --000000000000955e2705c8fbe3ff Content-Type: text/plain; charset="UTF-8" not sure if this message belongs on php-general@lists.php.net or internals@lists.php.net or elsewhere, i'll just try here first and see what happens, recently made some tests to check performance of UTF8 validators, and in that (simple non-comprehensive) test, preg_match() is ~33 times faster than mb_check_encoding(), and mb_check_encoding() is less than half the speed of iconv() (even though iconv isn't designed for validating at all, and makes a full copy of the string), can someone shed some light on this? why does mb_check_encoding seem to be so much slower than the alternatives? benchmark code+results is here https://stackoverflow.com/a/68690757/1067003 --000000000000955e2705c8fbe3ff--