Skip to content

Instantly share code, notes, and snippets.

@sscalpone
Created April 2, 2020 22:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sscalpone/79434dcdfd8e5d8b568a485329562063 to your computer and use it in GitHub Desktop.
Save sscalpone/79434dcdfd8e5d8b568a485329562063 to your computer and use it in GitHub Desktop.
% diff ./modifiedbench.cpp ~/klauslerbench.cpp
8,10d7
< //
< // The linux common case does not have carriage returns
< // Define USE_NL or USE_CR
65d61
< #if USE_CR
67,71d62
< #elif USE_NL
< src[j] = '\n';
< #else
< #error "Plese define one of USE_NL or USE_CR"
< #endif
%sh -x do.sh
+ which clang++
/usr/bin/clang++
+ clang++ --version
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
+ system_profiler SPHardwareDataType
Hardware:
Hardware Overview:
Model Name: Mac mini
Model Identifier: Macmini8,1
Processor Name: Intel Core i7
Processor Speed: 3.2 GHz
Number of Processors: 1
Total Number of Cores: 6
L2 Cache (per Core): 256 KB
L3 Cache: 12 MB
Hyper-Threading Technology: Enabled
Memory: 32 GB
Boot ROM Version: 220.270.99.0.0 (iBridge: 16.16.6571.0.0,0)
Serial Number (system): C07XM92JJYW0
Hardware UUID: 5FF7BA14-D935-5B33-AE1E-57A7B5A47D55
+ clang++ -O3 -std=c++11 ./modifiedbench.cpp -DREMOVE_CARRIAGE_RETURNS -DUSE_CR
+ ./a.out
996147
real 0m3.653s
user 0m3.649s
sys 0m0.003s
+ clang++ -O3 -std=c++11 ./modifiedbench.cpp -DREMOVE_IF -DUSE_CR
+ ./a.out
996147
real 0m3.143s
user 0m3.140s
sys 0m0.003s
+ clang++ -O3 -std=c++11 ./modifiedbench.cpp -DREMOVE_CARRIAGE_RETURNS -DUSE_NL
+ ./a.out
1048576
real 0m0.559s
user 0m0.556s
sys 0m0.003s
+ clang++ -O3 -std=c++11 ./modifiedbench.cpp -DREMOVE_IF -DUSE_NL
+ ./a.out
1048576
real 0m2.676s
user 0m2.673s
sys 0m0.003s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment