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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 9, 2010 at 11:36, Johannes Sixt <j.sixt@xxxxxxxxxxxxx> wrote:
> Am 11/9/2010 10:49, schrieb Ãvar ArnfjÃrà Bjarmason:
>> On Tue, Nov 9, 2010 at 10:47, Johannes Sixt <j.sixt@xxxxxxxxxxxxx> 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.

Thanks for elaborating. But just so I understand you correctly it's a
cost of invoking *any* program in shellscripts on Windows? So e.g. 10
sed calls would cost the same as 10 git-sh-i18n--envsubst calls (but
of course 5 eval_gettext() calls, since it calls git-sh-i18n--envsubst
twice).

So e.g. using eval_gettext once isn't a bigger problem than calling
some trivial sed substitution twice?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]