[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] strlen() optimizations (1)

From: Branko Čibej <brane_at_xbc.nu>
Date: 2002-12-06 22:35:11 CET

David Mankin wrote:

> Well, thanks to Brane's comments I did some benchmarks on my strlencmp
> method. I don't have svn setup so I can get realistic measurements of
> the function in real life, so I tested it in isolation.

Heh. Those results don't mean a thing. You have to measure how the code
behaves in the program you're actually trying to improve. When you test
things in isolation, different cache behaviour will skew the results,
often by so much that the results don't mean anything any more.

I got burned by this ince myself. I had a huge progem (1 Mloc) where bad
string handling used up about 25% of a crirical operation. So I wrote
"faster" macros and indeed, isolated measurements showed speedups of 2x
to 10x. So I spent two weeks reworking all the string handling code in
the critical path and guess what? After two weeks, I had shortened the
execution time by less than 2%, which was well within the error margin.
And of course, the code was less readable afterwards.

Measure first -- and always with real data.

-- 
Brane Čibej   <brane_at_xbc.nu>   http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Dec 6 22:36:00 2002

This is an archived mail posted to the Subversion Dev mailing list.