October 24, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Utility Libraries for BREW - A String Class

  • February 27, 2003
  • By Radu Braniste
  • Send Email »
  • More Articles »

Efficiency

BrewString library is extremely competitive in size. What about efficiency?We conducted some tests with 2 compilers and 2 STL implementations (I1 — uses small string optimization, I2 — basic STL model), to see how the differences between the ports affect the results. I1 had the optimization inhibited to make comparisons viable.

  • operator+ - see above
  • Assignment operator: is largely the same in all the cases
  • Copy constructor: BrewString is 20% faster than I1; BrewString is 3 times faster than I2
  • Substring: BrewString equals. I1; BrewString is 1.5 times faster than I2;
  • partialString : BrewString is 70 times faster than I1; BrewString is 5 times faster than I1 (small string optimization activated)
  • find_first_of : BrewString is 1.5 times faster than I1; BrewString is 2 times faster than I2

BrewString proves to have above average results for the minimum possible size, offering a good alternative to STL.

Epilogue -Deferred Improvements

BrewString was declared as

template <typename T = char  >class BrewString ;

The <typename T = AECHAR> policy is missing. Addditional optimizations are also possible. If there is interest in further developing and using this library (including using AEChar) please contact the author.

References:

[1] Scott Meyers - Effective STL; Addison-Wesley, 2001
[2] Scott Meyers - More Effective C++; Addison-Wesley, 1996
[3] Herb Sutter - More Exceptional C++; Addison-Wesley, 2001
[4] STL for eMbedded Visual C++ information page - http://www.syncdata.it/stlce/stlinfo.html
[5] Symbian OS Guide - http://www.symbian.com/developer/techlib/v70docs/sdl%5Fv7.0/doc%5Fsource/devguides/ProgLanguages.html#OSGuide%2eProgLanguages
[6] Dov Bulka, David Mayhew - Efficient C++ ; Addison-Wesley, 2000
[7] Andrei Alexandrescu: Generic<Programming>: Move Constructors - http://www.cuj.com/experts/2102/alexandr.htm


Downloads: Source Code - 189 kb.

About the Author

Radu Braniste is Director of Technology at Epicad. He can be contacted at rbraniste@epicad.com

# # #





Page 3 of 3



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel