git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC/PATCH 1/5] gettext: fix bug in git-sh-i18n's eval_gettext() by using envsubst(1)

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Nov 9, 2010, 10:36 UTC
Message-ID
<4CD9241F.6070807@viscovery.net>
In-Reply-To
<AANLkTi=23MXbZeBF=eJLRnQycx4Bdg_an2aa_3oGWR66@mail.gmail.com>
Am 11/9/2010 10:49, schrieb Ævar Arnfjörð Bjarmason:
Show 12 quoted lines
> On Tue, Nov 9, 2010 at 10:47, Johannes Sixt <j.sixt@viscovery.net> wrote:
>> Am 11/9/2010 10:35, schrieb Ævar Arnfjörð Bjarmason:
>>> Why is that a "*must*"?
>> ...
>>> But maybe you have reason to think otherwise? I haven't noticed any
>>> noticable slowdowns from doing it this way, but maybe I've been
>>> looking at the wrong thing.
>>
>> You didn't do your timings in Windows, did you? Every fork() that you can
>> avoid is a win.
> 
> What's the result of timing it on Windows?
I do not have gettext, hence, I test 'git version' as a reference:
$ time (for i in {1..100}; do git version; done) > /dev/null

real 0m5.610s user 0m1.707s sys 0m0.712s

Then I tested this function. It is not exactly the same that you tested, but it has the same number of subshells and builtin and external command invocations:

eval_gettext ()
{
    gettext "$1" |
    ( : `git-sh-i18n--envsubst <<< "$1"`
      git-sh-i18n--envsubst <<< "$1"
    )
}
$ time (for i in {1..100}; do eval_gettext foobar; done) > /dev/null

real 0m20.578s user 0m8.457s sys 0m3.915s

Note that there are only 100 iterations, so we are talking about 0.2 seconds per eval_gettext call! That's an awful lot of time even for a single error message.

-- Hannes
Previous: Ævar Arnfjörð BjarmasonNext: Erik Faye-Lund
Message 15 of 27 in “Buglet in i18n?”
  1. Johannes SixtOct 22, 2010
  2. Ævar Arnfjörð BjarmasonOct 22, 2010
  3. Jonathan NiederOct 22, 2010
  4. Ævar Arnfjörð BjarmasonOct 23, 2010
  5. Johannes SixtOct 22, 2010
  6. Ævar Arnfjörð BjarmasonOct 30, 2010
  7. 0/5 ab/i18n: Things I'll add in the next iterationÆvar Arnfjörð Bjarmason, Oct 31, 2010
  8. 1/5 gettext: fix bug in git-sh-i18n's eval_gettext() by using envsubst(1)Ævar Arnfjörð Bjarmason, Oct 31, 2010
  9. Johannes SixtNov 2, 2010
  10. Ævar Arnfjörð BjarmasonNov 8, 2010
  11. Johannes SixtNov 9, 2010
  12. Ævar Arnfjörð BjarmasonNov 9, 2010
  13. Johannes SixtNov 9, 2010
  14. Ævar Arnfjörð BjarmasonNov 9, 2010
  15. Johannes SixtNov 9, 2010
  16. Erik Faye-LundNov 9, 2010
  17. Ævar Arnfjörð BjarmasonNov 9, 2010
  18. Johannes SixtNov 9, 2010
  19. Ævar Arnfjörð BjarmasonNov 9, 2010
  20. Johannes SixtNov 9, 2010
  21. Ævar Arnfjörð BjarmasonNov 9, 2010
  22. Johannes SixtNov 9, 2010
  23. Ævar Arnfjörð BjarmasonNov 9, 2010
  24. 2/5 gettextize: git-clone: !fixup "basic messages"Ævar Arnfjörð Bjarmason, Oct 31, 2010
  25. 3/5 gettextize: git-init: !fixup "basic messages"Ævar Arnfjörð Bjarmason, Oct 31, 2010
  26. 4/5 gettextize: git-revert: !fixup "Your local changes"Ævar Arnfjörð Bjarmason, Oct 31, 2010
  27. 5/5 gettextize: git-merge: !fixup "basic messages"Ævar Arnfjörð Bjarmason, Oct 31, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.