Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
feintruled
on Sept 28, 2018
|
parent
|
context
|
favorite
| on:
Recursive fibonacci benchmark using top languages ...
I was intrigued to learn more about the winning language Nim to see how it beats C/C++, so I did a web search and was confounded to see Nim compiles to C/C++! What gives? Starting to doubt the methodology somewhat, though it was an interesting read.
fabriceleal
on Sept 28, 2018
[–]
Probably more about the difference between "echo" and "std::cout << ... << std::endl;" than the recursive function call.
Sean1708
on Sept 28, 2018
|
parent
|
next
[–]
I would be
very very
surprised if printing "2971215073" accounted for more than 1 second of runtime.
gambler
on Sept 28, 2018
|
root
|
parent
|
next
[–]
Well, I know that printing stuff to console can be ridiculously slow, so this doesn't surprise me much.
Sean1708
on Oct 3, 2018
|
root
|
parent
|
next
[–]
An entire second to print 10 characters?! How does a terminal that slow even exist?
VeXocide
on Sept 28, 2018
|
parent
|
prev
|
next
[–]
std::endl flushes which isn't cheap, you're generally better off simply steaming in a newline.
lucozade
on Sept 28, 2018
|
parent
|
prev
[–]
Most of it won't be because the C++ constexpr version has the same IO call and runs in <0.1s.
syockit
on Sept 28, 2018
|
root
|
parent
[–]
I think that's because even the std::cout call could be precalculated, so no runtime string concatenation and stream magic is involved.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: