Monthly ArchiveMay 2011
C++ 28 May 2011 19:04:13
C++ Convert String to Double Speed
(There is also a string-to-int performance test.)
A performance benchmark of which method is faster of converting an std::string to a double. The goal is ending up with a double of the value represented in an std::string.
The tested methods are:
- a hand-written naive loop
- atof()
- strtod()
- sscanf()
- boost::lexical_cast<double>()
- boost::spirit::qi::parse()
- std::stringstream
- std::stringstream, reusing the object
Source for the test is at speed-string-to-double.cpp with cycle.h.
The compilers are Microsoft Visual C++ 2010 with _SECURE_SCL disabled, GNU g++ 4.6.0, and LLVM clang++ from Arch.
Random 18 May 2011 21:32:04
BrainHex Class
Your BrainHex Class is Mastermind.
Your BrainHex Sub-Class is Mastermind–Seeker.
You like solving puzzles and devising strategies as well as finding strange and wonderful things or finding familiar things.
Each BrainHex Class also has an Exception, which describes what you dislike about playing games. Your Exceptions are:
» No Fear: You do not enjoy feeling afraid, preferring to feel safe or in control.
Your scores for each of the classes in this test were as follows:
Mastermind: 20
Seeker: 17
Achiever: 13
Socialiser: 7
Daredevil: 4
Conqueror: 2
Survivor: -2