[XeTeX] Performance of ucharclasses

Bruno Le Floch blflatex at gmail.com
Sun Oct 23 09:51:20 CEST 2011


>  please contact me (ideally on the XeTeX mailing list) and
>  we can discuss the changes you wish to make. If they
>  benefit everyone, they will be worked in as a new version.

I would like to invoke that clause.

I am definitely not planning to release any modified version of the package.


> Instead, you can create your own package which can be loaded on top of
> uchar.....sty or you can put your changes at the preamble of your
> document.

It turns out not to be possible to fix the problem without fixing
ucharclasses.sty itself.

Regards,
Bruno

> On Sun, Oct 23, 2011 at 6:14 AM, Bruno Le Floch <blflatex at gmail.com> wrote:
>
>> Hello all,
>>
>> Loading the ucharclasses package with no option is extremely slow (>
>> 2min on my installation), because it loads every Unicode block (as
>> documented).
>>
>> The performance can be significantly improved by using lower-level
>> code for the loops. For instance, using the following helper macro
>> (not quite optimized for speed, because I wanted to remain reasonably
>> close to the original \forloop syntax):
>>
>>    \newcommand{\@ucc at forloop}[1]
>>      {\expandafter\@ucc at forloop@\csname c@#1\endcsname}
>>    \newcommand{\@ucc at forloop@}[4]{%
>>      #1=#2\relax
>>      \loop
>>        #4\relax
>>      \ifnum#1<#3\relax
>>        \advance#1 by \@ne
>>      \repeat
>>    }
>>
>> we can replace the definition of `\@defineUnicodeClass` by
>>
>>    \newcounter{glyphcounter}
>>    \newcommand{\@defineUnicodeClass}[3]{%
>>      \newXeTeXintercharclass#1
>>      \@ucc at forloop {glyphcounter}{#2}{#3}
>>       {\XeTeXcharclass\value{glyphcounter}=#1}
>>   }
>>
>> (in other words, change the \forloop line). All other \forloop can be
>> replaced in a similar way, giving rise to a 10 fold speed improvement
>> at least.
>>
>> This post stems from an [answer I gave on the TeX.stackexchange
>> network](
>> http://tex.stackexchange.com/questions/32351/is-there-a-way-to-speed-up-the-use-of-ucharclasses/32379#32379
>> ).
>> Is that answer "legal", given the license of the package, or should I
>> delete it?
>>
>> Regards,
>> Bruno
>>
>>
>> --------------------------------------------------
>> Subscriptions, Archive, and List information, etc.:
>>  http://tug.org/mailman/listinfo/xetex
>>
>


More information about the XeTeX mailing list