Georg Baum wrote:
Abdelrazak Younes wrote:
Abdelrazak Younes wrote:
If you try out the document attached in bug 3561
(http://bugzilla.lyx.org/show_bug.cgi?id=3561) and View->Source, the
Encoding::init() will take 40 seconds on my system.
With the attached patch, this goes down to 25 seconds.
Your patch (+ the part that is already in) has several problems:
I secretly hoped that you would comment ;-)
- char ucs4_to_eightbit(char_type ucs4, string const & encoding) does not
make sense at all. You cannot guarantee that the result is only one char
I can add an assertion for that. If we use this method with multibytes
encoding then it will fail.
(besides it is unused).
Yes I know. But I planned to use it.
- The name of ucs4_to_multibytes is misleading: This function does exactly
the same as ucs4_to_eightbit, only optimized for one UCS4 char
Why misleading? This function is specifically designed for multibytes
encoding.
- Now there are two maps with ucs4 -> 8bit iconv processors, one is enough
and more efficient.
I know, I was about to remove the other template based ones once I
finished the transition.
- ucs4_to_multibytes silently fails for exotic conversions that result in
more than 4 bytes.
I didn't know that such encoding exists. I haven't find anything about
that in Wikipedia... That's why we need you Georg :-)
AFAIK LyX currently doesn't support such an encoding,
but AFAIK some exist and they could be supported in the future.
Agreed.
- there is no reason not to use the optimized map lookup in
eightbit_to_ucs4, too.
I don't like the template based method because that too is unoptimized.
Consider the attached (untested) version if you like.
Will try.
Abdel.