[sword-devel] Optimization Challenge I - SWBuf

Troy A. Griffitts sword-devel@crosswire.org
Sat, 19 Jul 2003 01:12:33 -0700


Daniel Glassey has reportedly saved 8% in time already on the benchmark. 
  Keep up the good work guys!

	-Troy.



Troy A. Griffitts wrote:
> Hey geeks,
> 
>     I have a challenge to pose! :)  There is new code in 
> sword/tests/swbuftest.cpp that performs speed tests.
> 
> I bet you can't make it faster! :)  (actually, I guess I bet you can or 
> I wouldn't be posting this email)
> 
> SWBuf is our new replacement for the STL std::string class.  It's used 
> throughout our engine now, and where we were not allowed to expose STL 
> in the API interfaces, now we can expose this class.
> 
> It is a very important class and it's methods are called 10's of 
> millions of times during a typical run of a sword application.
> 
> This means any improvement in speed (even milliseconds) will be 
> propagated in such a way as to make a big difference.
> 
> I'll perform the ratings on my system in single user mode so it's a fair 
> contest.  The current benchmarks are as follows:
> 
> [scribe@troyslaptop tests]$ time ./swbuftest > test.log
> 
> 
> append ch test -------
> 
> 
> append string test -------
> 
> 
> subscript access test -------
> 
> 
> constructor and assign test -------
> 
> 
> compare test -------
> 
> 
> real    0m18.378s
> user    0m16.030s
> sys     0m2.340s
> 
> 
> Now, I would suggest saving the time and test.log file from a clean copy 
>  run on your system, so you have something for comparison.  If a `diff 
> test.log.orig test.log` produces anything, don't even think about 
> submitting :)
> 
> The files involved should include:
> 
> sword/include/swbuf.h
> sword/src/utilfuns/swbuf.cpp
> 
> and for reference:
> sword/tests/swbuftest.cpp
> no changes to swbuftest.cpp, please.
> 
> And remember our API coding standards for cross-platform compatibility 
> and leave the assembly code out :)
> 
> 
> Have fun!
> 
>     -Troy.
> 
> 
> 
> _______________________________________________
> sword-devel mailing list
> sword-devel@crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel