TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Things that make Go fast

136 点作者 davecheney将近 11 年前

9 条评论

hendzen将近 11 年前
Escape analysis, dead code elimination, and function inlining are standard optimizations taught in an undergraduate compilers course. Go is cool, but I wouldn't really cite those as justifications for why.
评论 #7861804 未加载
评论 #7862263 未加载
Artemis2将近 11 年前
Unfortunately, Go&#x27;s compiler is not as fast as it could be; most of the optimizations presented here were already made by compilers in the 80s.<p>The fact that modern compilers are a really complex piece of software that took dozens of years to write and improve to the state we are at doesn&#x27;t helps. Hopefully, switching to a compiler written in pure Go in Go1.4 (IIRC) will allow code maintainers to benefit of Go&#x27;s simplicity.
Alupis将近 11 年前
The comparison between GO and Java seems unfair, given they compare a primitive variable with an object... which has methods and a bunch of other things to increase it&#x27;s size (for good reason).<p>Sure GO may be quick... but a JIT&#x27;ed java program will run at native C speed... because it&#x27;s been compiled down to native code at that point... (and most language performance comparison&#x27;s I&#x27;ve seen pop up generally ignore this fact and measure &quot;performance&quot; by timing runtime which includes the JVM firing up and executing cold&#x2F;non-jit&#x27;ed code... not real-world scenarios for high performance code.)
评论 #7861644 未加载
评论 #7862573 未加载
评论 #7861669 未加载
评论 #7861659 未加载
astrange将近 11 年前
Function calls aren&#x27;t that slow in an OoO processor - they&#x27;re perfectly predictable branches, so it can just start decoding from over there. There might be a cache miss, but there might also be fewer cache misses, or even better the CPU might skip decoding with a µop cache.<p>Really, the purpose of inlining is so inline functions can be specialized for their new context, which can easily make the total code size smaller. On x86, size&#x2F;speed tradeoffs just don&#x27;t happen like they used to.
评论 #7861928 未加载
HeroesGrave将近 11 年前
Things that make Go fast*<p>*compared to non-native languages like Python and Java.<p>Could people please stop calling their favourite language fast just because it beats an interpreted&#x2F;VM language.
评论 #7861673 未加载
评论 #7861642 未加载
评论 #7862278 未加载
zwieback将近 11 年前
I was surprised to see stack-check preambles mentioned here. Does that really happen on every function call? Or does it happen on a context switch? Usually stack-checking on function entry is considered something that makes code slow.
评论 #7862240 未加载
fiatmoney将近 11 年前
Hey, as long as we&#x27;re talking about Go performance - can we please, please get some kind of wide vector intrinsics (ie, no cgo overhead) in a library, or at least aggressive compiler generation of vector ops that actually use AVX &amp; the ARM NEON equivalent?<p>Right now peak floating-point performance isn&#x27;t even within half of what it should be on a very recent CPU, and I&#x27;d love to be able to deploy Go that exposes machine learning models to a network interface.
azam3d将近 11 年前
Go should replace Java in Android Development
评论 #7861879 未加载
评论 #7862439 未加载
评论 #7862423 未加载
robryk将近 11 年前
Nitpick: goroutine context switch can also happen at function calls (when the stack is being enlarged).
评论 #7861857 未加载