On 7/27/2025 4:59 PM, and...@borisov.dev wrote:
Hi!
We’ve been working on adding LuaMetaTeX and ConTeXt standalone support
for the Markdown package (https://github.com/Witiko/markdown/pull/557
<https://github.com/Witiko/markdown/pull/557>) and encountered an
interesting issue.
The package loads quite a huge library — `expl3-code.tex` from
`l3kernel` package which eats a lot of time during compilation.
What would be a good way to mitigate this? Is there a way to pre-load
the library before compilation? Perhaps by making a custom ConTeXt
format and making it with `context --make`?
The likelyhood of interfering is too big to even consider it. Loading
order matters and we also have some safeguards to consider. Calling it
context would also be confusing and the context runner and ecosystem
assumes certain names for formats and alike (also because we have a
multi lingual interface).
Unfortunately, I haven’t found a documentation on how to make your own
custom formats, hence this question.
There is no such option and there won't be. Quite some effort went into
making the format overhead as small as possible so it kind of defeats
the concept. Normally TeX is fast enough to load files.
As a side note: generating the context formats takes < 2 seconds once
the operating system has cached files, of course some more when a
machine comes from sleep. Also, we have experimented with no format at
all and even then the startup overhead on a run would be < 1.5 on a
modern machine (for metapost the format - mem file - already has been
dropped. Were talking of about 1000 tex and lua files. One main reason
for keeping the formaty is that is still pays off especially on network
shares, due to the number of files involved.
So, if loading some latex code that you need takes too long then there
is some issue with that code. Some time ago (when that performance
problem was reported) I tested that and loading this expl code takes
indeed some 9 seconds on my (somewhat older) machine but that is mostly
because it loads unicode and backend code and maybe more that is of no
use in the perspective of context which has all on board. So maybe that
can be skipped? or maybe that code is just not intgrated well, after
all, if we'd have such an issue in context, we'd use cached data (so
it's more of a conceptual expl problem but it's not up to me to deal
with that).
Actually, one can wonder what expl3 bring to context at all; some
intermediate layer like that just doesn't fit in. We try to make context
as fast as posisble and adding some layer doesn't help. (And personally
I realy dislike the look and feel of it and I'd dropped out of tex usage
if I'd have to use that; but that is personal of course and therefore
irrelevant). I suppose you need very little of that latex layer in
supporting context, if at all, right? Do you need some extra helpers in
context?
So, can't you avoid loading the bottleneck expl code? Skip unicode stuff
as a start? You probably then end up below a second. Boosting that code
(by looking at it i might spot some) is not on my agenda.
Thank you in advance!
P.S. What is the process of adding thrid-party modules in the default
list of ConTeXt distribution (https://modules.contextgarden.net/
<https://modules.contextgarden.net/>)? I think Markdown package might
proof very useful for a lot of folks and worth considering to be added
in the list. What do you think?
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
--
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________