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

Re: [PATCH] Simplify crud() in ident.c

From
LLLuke Lu <git@vicaya.com>
Date
Dec 3, 2007, 22:55 UTC
Message-ID
<903B0E5A-32E2-4029-90C1-8C227BEDD03D@vicaya.com>
In-Reply-To
<m3lk8bv8du.fsf@roke.D-201>
On Dec 3, 2007, at 12:19 PM, Jakub Narebski wrote:
> Perhaps simplier, but isn't it slower?

Actually it's faster on modern cpu with deep pipelines. The following is simple test on my macbookpro (repeated 3 times and picked lowest one):

$ time ./crudtest 1000000000 old crud... real 0m0.856s user 0m0.839s sys 0m0.011s $ time ./crudtest 1000000000 simple new crud... real 0m0.431s user 0m0.421s sys 0m0.007s

Note: it's compiled with gcc -O2. -O3 gives the same timing; -O:  
simple crud has the same timing while the old crud is 10x slower; -O0  
(off): the simple code is 50% slower than old crud (note: 10x less  
iterations):

$ time ./crudtest0 100000000 old crud... real 0m0.659s user 0m0.638s sys 0m0.008s $ time ./crudtest0 100000000 simple new crud... real 0m1.175s user 0m1.149s sys 0m0.014s

Since the default CFLAGS in git Makefile has -O2, the simple/new code is faster by default.

__Luke
Previous: Alex RiesenNext: Johannes Schindelin
Message 4 of 8 in “Simplify crud() in ident.c”
  1. Simplify crud() in ident.cAlex Riesen, Dec 3, 2007
  2. Jakub NarebskiDec 3, 2007
  3. Alex RiesenDec 3, 2007
  4. Luke LuDec 3, 2007
  5. Johannes SchindelinDec 3, 2007
  6. Alex RiesenDec 3, 2007
  7. Johannes SchindelinDec 3, 2007
  8. David KastrupDec 3, 2007

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.