directsetup vs setups
Hello list, Can anyone provide a description of, or a point to a description of, the differences between setups= and directsetup= for including setups? I searched the list archive and the documents and found nothing. (That may indicate my level of search foo, but nonetheless I am in need of help with this.) -- Rik
Oh yeah, I'd like to know more about this as well. Also, what about \fastsetup? Denis
-----Ursprüngliche Nachricht----- Von: ntg-context
Im Auftrag von Rik Kabel via ntg-context Gesendet: Montag, 15. November 2021 06:24 An: mailing list for ConTeXt users Cc: Rik Kabel Betreff: [NTG-context] directsetup vs setups Hello list,
Can anyone provide a description of, or a point to a description of, the differences between setups= and directsetup= for including setups? I searched the list archive and the documents and found nothing. (That may indicate my level of search foo, but nonetheless I am in need of help with this.)
-- Rik
__________________________________________________________ _________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg- context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net __________________________________________________________ _________________________
On 11/15/2021 6:24 AM, Rik Kabel via ntg-context wrote:
Hello list,
Can anyone provide a description of, or a point to a description of, the differences between setups= and directsetup= for including setups? I searched the list archive and the documents and found nothing. (That may indicate my level of search foo, but nonetheless I am in need of help with this.) \setup : takes a list ({...} or [...]) \directsetup: supports gridsnapping, only one setup \fastsetup : the fastest, only one setup
concerning performance, i wonder if you'll notice it \starttext \startsetups test \stopsetups \testfeatureonce{100000}{\setup {test}} \elapsedtime \par \testfeatureonce{100000}{\setup [test]} \elapsedtime \par \testfeatureonce{100000}{\directsetup{test}} \elapsedtime \par \testfeatureonce{100000}{\fastsetup {test}} \elapsedtime \par \stoptext because often what's done in the setup is taking the time, just test \startsetups test {\bf} \stopsetups you can volunteer to wikify it Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 2021-11-15 04:38, Hans Hagen via ntg-context wrote:
On 11/15/2021 6:24 AM, Rik Kabel via ntg-context wrote:
Hello list,
Can anyone provide a description of, or a point to a description of, the differences between setups= and directsetup= for including setups? I searched the list archive and the documents and found nothing. (That may indicate my level of search foo, but nonetheless I am in need of help with this.) \setup : takes a list ({...} or [...]) \directsetup: supports gridsnapping, only one setup \fastsetup : the fastest, only one setup
concerning performance, i wonder if you'll notice it
\starttext \startsetups test \stopsetups
\testfeatureonce{100000}{\setup {test}} \elapsedtime \par \testfeatureonce{100000}{\setup [test]} \elapsedtime \par \testfeatureonce{100000}{\directsetup{test}} \elapsedtime \par \testfeatureonce{100000}{\fastsetup {test}} \elapsedtime \par \stoptext
because often what's done in the setup is taking the time, just test
\startsetups test {\bf} \stopsetups
you can volunteer to wikify it
Hans Happy to wikify once I understand it.
On your empty performance test, I get around 0.10, .11, .08 for direct, and 0.4 for fast. With the grouped styling, those balloon to 0.50, 0.56, 0.48, and 0.44. So, some follow-up questions: 1. What do you mean by "only one setup" in the description of directsetup and fastsetup? I have examples of using two different directsetup in one after key, so it does not seem to mean that. 2. What is meant by saying that directsetup supports gridsnapping? Do you mean that fastsetup does not? (If that is the case, should a module writer not use fastsetup because it might be used in a document that requires a grid?) 3. Is the support for {} and [] in setup simply to maintain legacy support for {}, or are there reasons to choose one over the other? I do see consistently faster times with the curlies. 4. Are there operations that are supported in directsetup that are not supported in setup or fastsetup? Are there operations supported in fastsetup that are not supported in setup or directsetup? 5. Is it fair to say that setup can do the most, directsetup a bit less, and fastsetup is the most restrictive? Except for the most performance-constrained documents, setup is a safe choice, but when constructing modules or performance tuning, the others might be tested? -- Rik
Rik Kabel via ntg-context schrieb am 15.11.2021 um 19:06:
So, some follow-up questions:
1. What do you mean by "only one setup" in the description of directsetup and fastsetup? I have examples of using two different directsetup in one after key, so it does not seem to mean that.
With \directsetup, \fastsetup and \setup (I'm correcting Hans here) you can pass only the name of a single setups-environment as argument, e.g. \directsetup{my_fancy_setup} while \setups allows you to pass a list of names, e.g. \setups[custom_setup_a,custom_setup_b,...]
2. What is meant by saying that directsetup supports gridsnapping? Do you mean that fastsetup does not? (If that is the case, should a module writer not use fastsetup because it might be used in a document that requires a grid?)
The \startsetups environment has a optional argument which accepts (at the moment) the "grid" keyword to set values which are only used when grid snapping (\setuplayout[grid=yes]) is enabled, e.g. \startsetups [grid] [my_fancy_setup] % settings which are used when grid mode is enabled \stopsetups \startsetups [my_fancy_setup] % settings which are used when grid mode is disabled % or when no grid related setups with the same name exist \stopsetups When you now use \directsetup{my_fancy_setup} (or \setup[...]) ConTeXt checks if grid mode is enabled and selects the right settings but \fastsetup never performs this check and always uses the non grid settings. The \fastsetup command is even more basic because it doesn't even check if there is a setups environment with the given name which is done by the other commands.
3. Is the support for {} and [] in setup simply to maintain legacy support for {}, or are there reasons to choose one over the other? I do see consistently faster times with the curlies.
You can run Hans example with MkIV and the differences should be even bigger because the check for [] is slower here while in LMTX it's a engine feature. The main difference in LMTX is a extra expansion for \setup compared to \directsetup.
4. Are there operations that are supported in directsetup that are not supported in setup or fastsetup? Are there operations supported in fastsetup that are not supported in setup or directsetup?
There is no difference between \setup and \directsetup but \fastsetup should only be used when you can ensure the requested environment exists.
5. Is it fair to say that setup can do the most, directsetup a bit less, and fastsetup is the most restrictive? Except for the most performance-constrained documents, setup is a safe choice, but when constructing modules or performance tuning, the others might be tested?
As I already wrote before there is no difference between \setup and \directsetup. When you care about performance \directsetup is the wrong start because you won't notice a difference. Wolfgang
On 11/15/2021 7:06 PM, Rik Kabel via ntg-context wrote:
On your empty performance test, I get around 0.10, .11, .08 for direct, and 0.4 for fast. With the grouped styling, those balloon to 0.50, 0.56, 0.48, and 0.44. just for the record, here with lmtx i get (on a 2013 laptop):
0.128 0.130 0.114 0.057 0.686 0.674 0.660 0.602 while mkiv does: 0.211 0.224 0.131 0.055 0.763 0.767 0.677 0.597 (normally one will use at least a million tests because th elast digot is kind of meaningless; also the used compiler matters) but i bet that on an average job our machines don't perform too different (simple tests like these are happily using the cpu cache) it's not that easy to make tex jobs run faster but also not that hard to make them run slower, which i try to avoid -) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (5)
-
denis.maier@unibe.ch
-
Hans Hagen
-
Rik Kabel
-
Rik Kabel
-
Wolfgang Schuster