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

Re: [PATCH v2] macos: lazily initialize iconv

From
Torsten Bögershausen <tboegi@web.de>
Date
Aug 10, 2012, 21:11 UTC
Message-ID
<50257906.1010606@web.de>
In-Reply-To
<7vsjbuk3v3.fsf@alter.siamese.dyndns.org>
On 10.08.12 20:18, Junio C Hamano wrote:
Show 30 quoted lines
> Torsten Bögershausen <tboegi@web.de> writes:
>
>> On 31.07.12 20:37, Junio C Hamano wrote:
>>> In practice, the majority of paths do not have utf8 that needs
>>> the canonicalization. Lazily call iconv_open()/iconv_close() to
>>> avoid unnecessary overhead.
>>>
>>> Signed-off-by: Junio C Hamano <gitster@pobox.com>
>>> Helped-by: Ralf Thielow <ralf.thielow@gmail.com>
>>> Helped-by: Linus Torvalds <torvalds@linux-foundation.org>
>>> ---
>>>
>>>  * This is not even compile tested, so it needs testing and
>>>    benchmarking, as I do not even know how costly the calls to
>>>    open/close are when we do not have to call iconv() itself.
>>> ...
>> Hi Junio,
>>
>> thanks for the optimization.
>> Tested-by: Torsten Bögershausen <tboegi@web.de>
> Well, I didn't mean the correctness testing without numbers.  The
> correctness of the patch after a couple of people eyeballed it was
> no longer a question.
>
> If the patch does not give any measuable performance difference to
> people who exercise this codepath, it is not worth merging.  And
> that is not something I can't do myself without a Mac (nor I wish to
> have one to be able to do so myself).
>
> Thanks.

Really sorry for the confusion with the percentage, I should have written: The patch is tested OK, and we can even remove 2 lines of code, where we save and restore errno. They are no longer needed.

Here some benchmarks on my system (Intel Core 2 Duo @ 3,06 GHz, L2-Cache: 3 MB, Memory: 4 GB) running git status on the linux source tree.

After cloning, I set "git config core.precomposeunicode true".

git is v1.7.12.rc2, git_git/git is with your patch.

git v1.7.12.rc2: tb@birne:~/projects/git/linux-2.6> for f in 1 2 3 4 5; do time git status ; done 2>&1 | egrep "^user|^real|^sys" real 0m0.469s user 0m0.283s sys 0m0.175s

real 0m0.461s user 0m0.283s sys 0m0.170s

real 0m0.460s user 0m0.283s sys 0m0.170s

real 0m0.461s user 0m0.283s sys 0m0.177s

real 0m0.460s user 0m0.283s sys 0m0.176s

With lazy init of iconv: tb@birne:~/projects/git/linux-2.6> for f in 1 2 3 4 5; do time ~/projects/git/git_git/git status ; done 2>&1 | egrep "^user|^real|^sys" real 0m0.463s user 0m0.282s sys 0m0.173s

real 0m0.460s user 0m0.281s sys 0m0.172s

real 0m0.460s user 0m0.281s sys 0m0.172s

real 0m0.463s user 0m0.281s sys 0m0.175s

real 0m0.462s user 0m0.281s sys 0m0.177s

Previous: Junio C HamanoNext: Junio C Hamano
Message 14 of 15 in “macos: lazily initialize iconv”
  1. macos: lazily initialize iconvJunio C Hamano, Jul 31, 2012
  2. Junio C HamanoJul 31, 2012
  3. Ralf ThielowJul 31, 2012
  4. Junio C HamanoJul 31, 2012
  5. macos: lazily initialize iconvJunio C Hamano, Jul 31, 2012
  6. Ralf ThielowJul 31, 2012
  7. Junio C HamanoJul 31, 2012
  8. Linus TorvaldsJul 31, 2012
  9. Junio C HamanoJul 31, 2012
  10. Linus TorvaldsJul 31, 2012
  11. Torsten BögershausenAug 1, 2012
  12. Torsten BögershausenAug 10, 2012
  13. Junio C HamanoAug 10, 2012
  14. Torsten BögershausenAug 10, 2012
  15. Junio C HamanoAug 10, 2012

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.