Re:Why is this C++ code faster than my hand-written assembly...
by ghettoimp on Tuesday August 22, 2017 @10:07AM
(#15072510)
This probably wouldn't be a very good optimization puzzle as the cost of printing would so dominate the arithmetic operations. :(
[ Parent
| on HN ]
Re:Why is this C++ code faster than my hand-written assembly...
by raphlinus on Tuesday August 22, 2017 @10:09AM
(#15072534)
This is true, and I've thought about it a bit. If you were really optimizing, then maybe the goal would be stated as putting the completed answer into a memory buffer. But for now, shave as many nanoseconds as you can from the logic and pretend we don't have to worry about printing.