Navigation Menu

Skip to content

norcalli/number-parse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

number-parse

A fast templated number parsing library in C++.

##Speed Tests: #####Requires boost for lexical_cast

Commands were generated by compiling speed-string-to-int.cpp, and then interpreted by interpret.go into an svg plot as such:

g++ speed-string-to-int.cpp -I/opt/local/include -o ./speedtest
./speedtest | go run interpret.go

This test shows that ExtractInt is about 5% faster than the next fastest number parser. The consistency compared to other methods is also notable. I still have more optimization to do as well.

#Usage: The methods accept an iterator and only consume as much as they need to. They stop consuming at the first character which isn't a match to the number patterns.

Iterators are simply anything with a increment ++ operator, as no backtracking is needed or done. ##Methods: The methods follow a simple style pattern PrefixSuffix (e.g. ParseInt).

The prefixes denote iterator access:

  • Parse: The iterator is modified.
  • Extract: The iterator is copied and not modified.

The suffixes denote the type to scan for:

  • UInt: unsigned integer
  • Int: integer
  • UFloat: unsigned float
  • Float: float

About

A fast templated number parsing library in C++.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published