As mentioned in the title, I\'m looking for something that can give me more performance than atoi. Presently, the fastest way I know is
atoi(mystring.c_str(
A faster convert function only for positive integers without error checking.
Multiplication is always slower that sum and shift, therefore change multiply with shift.
int fast_atoi( const char * str ) { int val = 0; while( *str ) { val = (val << 3) + (val << 1) + (*str++ - '0'); } return val; }