Open user202729 opened 1 year ago
There are 2 different ways used by the code to define math control sequences:
for mathord etc.: \let \uparrow ↑
\let \uparrow ↑
https://github.com/wspr/unicode-math/blob/master/um-code-setchar.dtx#L56
for mathopen etc.:. \protected\def \langle {\Udelimiter 4\symoperators "027E8\scan_stop: }
\protected\def \langle {\Udelimiter 4\symoperators "027E8\scan_stop: }
https://github.com/wspr/unicode-math/blob/master/um-code-setchar.dtx#L203
It appears that the first approach is always better and works for both? Did I miss something?
Some tests. The first one is faster as well.
%! TEX program = lualatex \documentclass{article} \usepackage{unicode-math} \usepackage{l3benchmark} \begin{document} \meaning\langle % \Udelimiter 4 \symoperators "027E8 \scan_stop: mathcode: "\csname int_to_Hex:n\endcsname{\Umathcodenum `⟨} delcode: "\csname int_to_Hex:n\endcsname{\Udelcodenum `⟨} \[\langle 123\] \ExplSyntaxOn \benchmark:n{\setbox0 \vbox{\[\langle 123\]}} \fp_use:N \g_benchmark_time_fp \ExplSyntaxOff \[\left\langle \frac{123}{456} \right.\] \[\bigg\langle 123\] \[\biggl\langle 123\] \ExplSyntaxOn \benchmark:n{\setbox0 \vbox{\[\left\langle \frac{123}{456} \right.\]}} \fp_use:N \g_benchmark_time_fp \ExplSyntaxOff \let \oldlangle \langle \let \langle ⟨ \[\langle 123\] \ExplSyntaxOn \benchmark:n{\setbox0 \vbox{\[\langle 123\]}} \fp_use:N \g_benchmark_time_fp \ExplSyntaxOff \[\left\langle \frac{123}{456} \right.\] \[\bigg\langle 123\] \[\biggl\langle 123\] \ExplSyntaxOn \benchmark:n{\setbox0 \vbox{\[\left\langle \frac{123}{456} \right.\]}} \fp_use:N \g_benchmark_time_fp \ExplSyntaxOff \let \langle \oldlangle \ExplSyntaxOn \benchmark:n{\setbox0 \vbox{\[\langle 123\]}} \fp_use:N \g_benchmark_time_fp \ExplSyntaxOff \ExplSyntaxOn \benchmark:n{\setbox0 \vbox{\[\left\langle \frac{123}{456} \right.\]}} \fp_use:N \g_benchmark_time_fp \ExplSyntaxOff \end{document}
There are 2 different ways used by the code to define math control sequences:
for mathord etc.:
\let \uparrow ↑
https://github.com/wspr/unicode-math/blob/master/um-code-setchar.dtx#L56
for mathopen etc.:.
\protected\def \langle {\Udelimiter 4\symoperators "027E8\scan_stop: }
https://github.com/wspr/unicode-math/blob/master/um-code-setchar.dtx#L203
It appears that the first approach is always better and works for both? Did I miss something?
Some tests. The first one is faster as well.