Re: iconv vs. mbstring

From: Date: Thu, 05 Mar 2020 15:13:55 +0000
Subject: Re: iconv vs. mbstring
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-108872@lists.php.net to get a copy of this message
On 05.03.2020 at 15:33, Rowan Tommins wrote: > On Thu, 5 Mar 2020 at 11:59, Aleksander Machniak <alec@alec.pl> wrote: > >> Also, I have a case in which iconv_* functions were much much slower >> than mbstring. See wordwrap implementation in >> >> >> https://github.com/roundcube/roundcubemail/blob/master/program/lib/Roundcube/rcube_mime.php#L589 > > Either I misread, or you did: I thought that's exactly what Christoph was > saying, that iconv_* functions will be slower because they basically do > convert-process-unconvert rather than having implementations for each > encoding. So mb_strlen will always be faster than iconv_strlen. > > iconv() vs mb_convert_encoding() doesn't have the same penalty. It seems > quite plausible that a library dedicated to converting charsets would be > more optimised for that job than a single function in a larger library > mainly focussed on working with one charset at a time. I should add that all my testing was done solely with a current libiconv version (on Windows); I don't know how libc's ivonc() and other implementations might perform. -- Christoph M. Becker

« previous php.internals (#108872) next »