TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Count to 1B in Ruby, Python, R, JavaScript and C++

4 pointsby nomilkover 1 year ago

2 comments

andy99over 1 year ago
Some compilers should be able to optimize the loop away and just display the final value when the code runs.<p>Edit: discussed previously <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=35398298">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=35398298</a>
评论 #39157011 未加载
nomilkover 1 year ago
Results:<p>c++ 1.129 seconds<p>python 41.674 seconds<p>ruby 8.730 seconds<p>R 13.602 seconds<p>js (node) 0.481 seconds<p>What surprises me: Python slower than R and ruby. js faster than c++.
评论 #39158647 未加载
评论 #39158164 未加载