Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Obligatory question: what compiler options did you use for c++? Good first try is -o3 -march=native. It really makes huge difference in case of C/C++


It's in the makefile in that repo:

    	g++ cpp.cpp -std=c++11 -Wall -O2 -march=native -o cpp
I was originally using -O3 but then someone found that -O2 is actually faster in this case.


When visited was changed from a vector<bool> to a bitset<T>, why is it not passed by reference anymore?


The most common call in the benchmark is to `getLongestPath<16>`. Passing 16 bits by value is cheaper and easier for the compiler to optimize (i.e., no aliasing) than passing by reference. I'd expect graphs with many nodes to behave differently.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: