-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
amsmath.dtx: Request to speed up \genfrac@choice #433
Comments
@RuixiZhang42 I'm reluctant to do speed improvements in a case like this to be honest. The gain seems fairly small even in a document that is doing a lot of math. And one thing I learned is that even the simples internal change is breaking something somewhere along the line. Now that doesn't mean would shouldn't do something and live with the consequences (eg finding the packages that break, talk to the maintainers get things adjusted, etc) but for me it means one should only do this if either a) it is a clear bug or b) it is a very substantial improvement in speed or c) a very strong case of normalization that helps a lot later on. So far I'm not convinced the suggestion falls into either category, but perhaps this is seen differently by others. |
@FrankMittelbach This is understandable. I guess my request has more to do with the something like this: % !TeX program = XeLaTeX
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Here is a display with some text in it
\[
\dbinom{n}{k},\quad\text{where $\dbinom{n}{k}$ is defined by\dots}
\]
\end{document} The inline math within the text within the display ends up being typeset 4×4 times (or 4×8 times if we count opening/closing parenthesis separately), compared with just 4 times for the text if This XeTeX/LuaTeX version is based on engine, not on math fonts. Both XeTeX and LuaTeX can use TFM-based fonts, where the classical version of |
I did wonder about that at the time, but that would mean a run-time check on every fraction whether the main math font had the needed parameters (I don't think either xetex or luatex have a simple built in boolean flag to say the classic or opentype math layout is being used) and would mean having both versions active and more code paths to check.. As this was something of an "emergency fix" at the time to get generalised fractions working for the AMS, having a simplified code path to test was more important than optimising the time. (You would have to have a lot of fractions before the time was noticeable in comparison to say how long unicode-math spends reading the unicode-math-table file.) I suspect that this should be merged into the longish term xmath project see https://github.com/latex3/latex2e/projects to look at future improvements. That said, we do need to change something here to fix your previous issue #432 (which is a definite bug) |
@davidcarlisle do you think we can get to a conclusion here? |
ah, overlooked you already said parts of that. So can we "do something" with respect to #432 and move the resto to xmath? |
This issue has been automatically marked as stale because it has not had recent activity. |
Brief outline of the enhancement
For XeTeX/LuaTeX, the
\genfrac
command relies on\genfrac@choice
to generate delimited fraction. But\genfrac@choice
always makes a four-way choice, for each of the opening and closing delimiters (if they are present). Those are 8 tries for typesetting a single\binom{n}{k}
. The same is true even when mathstyle is forced:\dbinom{n}{k}
still requires 8 tries, and\tbinom
still requires 8 tries, too.When a mathstyle is forced, can we speed things up by avoiding
\mathchoice
?Experimental code proposal
The text was updated successfully, but these errors were encountered: