Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize delimiter by assigning it to the character? #612

Open
user202729 opened this issue May 12, 2023 · 0 comments
Open

Optimize delimiter by assigning it to the character? #612

user202729 opened this issue May 12, 2023 · 0 comments

Comments

@user202729
Copy link

There are 2 different ways used by the code to define math control sequences:

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}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant