From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/113422 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Wolfgang Schuster via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: directsetup vs setups Date: Mon, 15 Nov 2021 19:54:59 +0100 Message-ID: <2bcacade-324c-26c1-16cf-293168c8ca3f@gmail.com> References: <9314580b-537f-a406-0bab-4db53c71d8bf@rik.users.panix.com> <9ca345bf-bcb7-0e13-262e-830563326384@panix.com> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8593986564896184277==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7548"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 PostboxApp/7.0.51 Cc: Wolfgang Schuster , Rik Kabel To: mailing list for ConTeXt users , Rik Kabel via ntg-context Original-X-From: ntg-context-bounces@ntg.nl Mon Nov 15 19:55:35 2021 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mmh8h-0001h1-8l for gctc-ntg-context-518@m.gmane-mx.org; Mon, 15 Nov 2021 19:55:35 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 623B8289124; Mon, 15 Nov 2021 19:55:06 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MV_rXH3QdjPW; Mon, 15 Nov 2021 19:55:04 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 5F3DC28930F; Mon, 15 Nov 2021 19:55:04 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 1E24D289262 for ; Mon, 15 Nov 2021 19:55:02 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oPgZbneR3qLD for ; Mon, 15 Nov 2021 19:55:01 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.221.52; helo=mail-wr1-f52.google.com; envelope-from=wolfgang.schuster.lists@gmail.com; receiver= Original-Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 3EC4B289124 for ; Mon, 15 Nov 2021 19:55:01 +0100 (CET) Original-Received: by mail-wr1-f52.google.com with SMTP id t30so32595871wra.10 for ; Mon, 15 Nov 2021 10:55:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=vT9rCLtW4wHpiFUOtUNqPqtx1QY2I92E1V48oI7/2k4=; b=MU3EwtdtCSLzV+Epo0rdci2b3x48UldXdVaj83Br6ct3kgznuHZ1pvoIj+O5o7Phjc ws0g4WHtpsJw2L30CZDwq/iKDd6PJd0+Tp88HzguZbj35RwnlXNeeSbiDwtYj8PxLltY JCFRonQUi2o46jz2iAbdwn9KicwSrTeOlsBH3er2lK/ke9I3BS1bSTfy4cYUwmAMmJ6t YIu3CLHH4M1iRHJsfTogpMz2xSSg47hnQF0POzFGQHV+cGnQv+CkfwH1hftSFxGxw61A zl7iQXK9V1JkQT/vk93MVNc1BBv3BENfsGmbM/IJCz7I9vyIRXG/f/UicMxRWHSxooJr PioQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=vT9rCLtW4wHpiFUOtUNqPqtx1QY2I92E1V48oI7/2k4=; b=6Tp062Kxzge8Y2I6UrHz8Vi8EByIJdXQuZ73C/fPyRqn39sfokzR3CJ4sx8s1ZFADi R6zHp3vh5BJEMXngE9c2i+rZzQKPKsZBXtkmfMGn0JnUgdd/B9NmUeNVIagO4CO5H5KY ACNojdUWuOvAR3PmUKRbObu6SyDtFw9xVg4ISI2R0WuX6IYAZswCX7A8h42QLmFnIar4 KYWW6nws6rXUrQI6YimSP9txwJ0Wc5Uq/9TjsjKhuXgDYZyxsOg3PgtsuaG6woMhRtUE EACaQ6q8iVy/GIvPqD6aly+NcsjYLcVsosan+V1smUln5OfBiSzDwD/b6qUflzdWhJ57 OtvA== X-Gm-Message-State: AOAM533NBsfdHDW63LdWnkij3f/RxDAhF8PRhy4Cqn6lfzz9Dl4chzPC QavSgm219qyJhFOLj1mMDTDvgnOjAgQ= X-Google-Smtp-Source: ABdhPJwLZD4o5jGX+eMD2WVrJxigkfwsI0uU/HzMxLXrT4EIGLjIBClEQKw4rEkTPDnRmG8EHh7Brw== X-Received: by 2002:a5d:6347:: with SMTP id b7mr1567054wrw.36.1637002500977; Mon, 15 Nov 2021 10:55:00 -0800 (PST) Original-Received: from ?IPv6:2a02:810d:a8bf:f874:4581:4215:f65a:89e2? ([2a02:810d:a8bf:f874:4581:4215:f65a:89e2]) by smtp.gmail.com with ESMTPSA id t1sm17179977wre.32.2021.11.15.10.55.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Nov 2021 10:55:00 -0800 (PST) In-Reply-To: <9ca345bf-bcb7-0e13-262e-830563326384@panix.com> Content-Language: en-US X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:113422 Archived-At: This is a multi-part message in MIME format. --===============8593986564896184277== Content-Type: multipart/alternative; boundary="------------628846CB4FD6FF10BCFCC893" Content-Language: en-US This is a multi-part message in MIME format. --------------628846CB4FD6FF10BCFCC893 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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 --------------628846CB4FD6FF10BCFCC893 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit 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

--------------628846CB4FD6FF10BCFCC893-- --===============8593986564896184277== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============8593986564896184277==--