-
Notifications
You must be signed in to change notification settings - Fork 178
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
Faster \cs_if_free:N
tests, for faster loading
#17
Comments
On the |
Right, we've already agreed that kernel code is to be written with the Npn variants only for this reason. I'd go so far as to suggest defining an "optimised"
I'd actually go further and say we should drop the extra check for |
I'm no so sure about having different definitions for |
Okay, let's pencil in to move the |
Sounds OK to me. |
Done in the 'big bang' code: to commit later today |
Loading speed is an issue for slow computers. One very much used function is
\cs_new:Npn
. Currently\cs_new:Npn \foo:N
produces 138 lines in the log. With the changes below, we reduce to 75 lines. It seems to speed up the loading by roughly10%
(I was hoping for more...). On a similar note, I would advise against using the Nn variants, which take ~100 more lines...Proposal to change
\cs_if_free:N
towhere the
_r
variant of\cs_if_do_not_use:N
is defined below.Currently
\cs_if_do_not_use_p:N #1
returns true if#1
has:
in its\cs_to_str:N
, and:
is exactlyD
.This is equivalent to
#1
finishes with:D
, and:
in its name.I propose to relax the second condition (refusing slightly more functions) to get a faster test, which just checks whether the name finishes with
:D
.A slightly weird kind of conditional, which does
\prg_return_true/false:
rather than expanding to\c_true/false_bool
as the predicate variant, or to some\use
for theTF
variants.The predicate variant seems to be used somewhere in
l3expan
.We need something special just for the case of the cs
\D
when the escape character is:
(just one tiny case:-s
). Otherwise, we grab until:DA
, whereA
has catcode letter (hence not present in the result of\token_to_str:N
).Don't trust this code: I might have screwed up slightly.
The text was updated successfully, but these errors were encountered: