Skip to content

Instantly share code, notes, and snippets.

@fcamel
Last active October 15, 2016 18:00
Show Gist options
  • Save fcamel/3c0503adfa63f89e28db471bec0919c0 to your computer and use it in GitHub Desktop.
Save fcamel/3c0503adfa63f89e28db471bec0919c0 to your computer and use it in GitHub Desktop.
$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.38)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ g++ count_bits.cpp -o count_bits -std=c++11 -O0
$ ./count_bits
count_by_table : sum=7999011000, duration=1735250964ns
count_by_bit_operation: sum=7999011000, duration=1024207704ns
$ g++ count_bits.cpp -o count_bits -std=c++11 -O3
$ ./count_bits
count_by_table : sum=7997909000, duration=513859720ns
count_by_bit_operation: sum=7997909000, duration=343567094ns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment