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.

A possible new back end for Rust

526 pointsby oblabout 5 years ago

18 comments

pizlonatorabout 5 years ago
This is really great. The world needs more diverse compiler tech. The llvm monoculture is constraining what kind of compiler research folks do to just the things that are practical to do in llvm.<p>I particularly suspect that if something like Cranelift gets evolved more then it will eventually reach throughput parity with llvm, likely without actually implementing all of the optimizations that llvm has. It shouldn’t be assumed that just because llvm has an optimization that this optimization is profitable anywhere but llvm or at all.<p>Final thought, someone should try this with B3. <a href="https:&#x2F;&#x2F;webkit.org&#x2F;docs&#x2F;b3&#x2F;" rel="nofollow">https:&#x2F;&#x2F;webkit.org&#x2F;docs&#x2F;b3&#x2F;</a>
评论 #22937394 未加载
评论 #22935176 未加载
评论 #22937398 未加载
评论 #22935146 未加载
评论 #22936030 未加载
评论 #22939739 未加载
评论 #22935257 未加载
评论 #22935500 未加载
dwheelerabout 5 years ago
One cool advantage of having multiple compilers for a language is that you can use one as a check on the other.<p>For example, if you&#x27;re worried that one of the compilers might be malicious, you can use the other compiler to check on it: <a href="https:&#x2F;&#x2F;dwheeler.com&#x2F;trusting-trust" rel="nofollow">https:&#x2F;&#x2F;dwheeler.com&#x2F;trusting-trust</a><p>Even if you&#x27;re not worried about malicious compilers, you can generate code, compiled it against multiple compilers, and sending inputs and see when they differ in the outputs. This has been used as a fuzzing technique to detect subtle errors in compilers.
评论 #22938123 未加载
评论 #22937943 未加载
liquidifyabout 5 years ago
&gt;&gt;&quot;That’s Bjorn3, he decided to experiment in this area whilst on a summer vacation, and a year &amp; half later single-handedly (bar a couple of PRs) achieved a working Cranelift frontend.&quot;<p>Is this guy human? This is amazing, and this guy should be given an award.
WalterBrightabout 5 years ago
The D programming language has 3 compilers, one with LLVM (LDC) one with GCC (GDC) and one with the Digital Mars back end (DMC).<p>It&#x27;s great to have all three, as they each have different characteristics in terms of speed, generated code, debug support, platform support, etc. Supporting these three also helps maintain proper semantic separation of code gen from front end.
评论 #22946509 未加载
korpiqabout 5 years ago
This feels welcome to me. I tend to think a language needs multiple independent implementations that only share the same source language spec, in order to really tear a clear spec apart from the quirks of any particular implementation.<p>I find Rust (the spec, though also the implemenration) quite safe and practical (a balance). It deserves some independent implementations to secure a long and stable future.<p>On the other hand, I want to use it on non-ARM embedded platforms, where current cross-compilation through C produces unusably big binaries. I dream this might increase hope for that, too, eventually.
评论 #22935299 未加载
andrewprockabout 5 years ago
The thing that struck me most about the article was this quote from the Rust Survey (2019):<p>“Compiling development builds at least as fast as Go would be table stakes for us to consider Rust“<p>Go was designed from the ground up to have super fast compile times. In fact, there are some significant language issues related to that design decision.<p>Using one of the primary design goals that impacted language structure as &quot;table stakes&quot; is almost certainly going require a lot of effort with some serious unintended consequences.<p>Improving compilation times sounds good. Aiming high is good. But reaching &quot;best of breed performance&quot; is major initiative.
评论 #22937305 未加载
Waterluvianabout 5 years ago
When writing a language like Rust, is the biggest challenge simply deciding what Rust&#x27;s features and behaviors should be? And implementing the syntax and Rust -&gt; LLVM compiler is really just a chore for the individuals who are super familiar with the implementation of these languages? Or is the technical implementation also genuinely challenging and non-obvious?
评论 #22936716 未加载
评论 #22936603 未加载
评论 #22936610 未加载
gokabout 5 years ago
Novel compiler backends are a super cool idea, but I don&#x27;t think it&#x27;s going to help Rust compile speeds as much as this posts suggests. The complexity of Rust&#x27;s type system puts a pretty high lower bound on compile times because of work the front end needs to do. Plain C compiles quickly even with an LLVM backend, for example.
评论 #22936239 未加载
评论 #22936246 未加载
评论 #22936078 未加载
评论 #22937345 未加载
Koshkinabout 5 years ago
I&#x27;ve been wondering lately if the modern compilers should all be using C as the intermediate language (or some language-specific code optimization opportunities could be lost if they do that).
评论 #22935720 未加载
评论 #22936232 未加载
评论 #22935160 未加载
评论 #22935268 未加载
评论 #22935232 未加载
评论 #22935281 未加载
评论 #22935454 未加载
评论 #22935959 未加载
评论 #22937291 未加载
jlebarabout 5 years ago
If there are any rust people here, you&#x27;ve probably considered that you can speed up your debug llvm builds by enabling some optimizations. SimplifyCFG comes to mind, but, like, you can experiment. I presume the reason you haven&#x27;t is because you want to preserve debug info, and llvm isn&#x27;t great at that when optimizations are on.
评论 #22935408 未加载
cradabout 5 years ago
While it appears that cg_clif is faster to compile, does it provide any performance benefit compared to cg_llvm? Are the compiled binaries as fast as llvm compiled binaries? If not is the use-case for development purposes only?
评论 #22935172 未加载
评论 #22935181 未加载
mttyngabout 5 years ago
This is awesome. It doesn’t even seem that long ago when Boa was started! Man, time flies and people do great things. Kudos to the author and co-contributors for what Boa has become.
tyrionabout 5 years ago
Thanks for nice article! Hoping the author reads the comments, I would like to leave an, hopefully useful, feedback.<p>It would greatly improve the reading experience of your blog if you could make clickable the footnotes&#x2F;references.<p>For example when you say:<p>&gt; I’ve taken the chart from the 2016 MIR blog post[3]<p>I have to scroll to the end of the page to find the blog post (and then scroll back to resume reading). If [3] were clickable it would be great. It would be even better if [MIR blog post] were an actual link itself.
tester3about 5 years ago
How do they ensure that output of both compilers is correct?<p>e.g LLVM output is A, but the new one is B, how do they deal with different results between backends?
Myrmornisabout 5 years ago
There wouldn&#x27;t be any surprises, or cognitive dissonance, from using very different paths for debug versus release builds?<p>On a small project, personally I use --release sometimes during development because the compile time doesn&#x27;t matter that much and the resulting executable is much faster: if I don&#x27;t use --release I can get a misleading sense of UX during development.
评论 #22938507 未加载
评论 #22939129 未加载
ameliusabout 5 years ago
Does it support JIT compilation, i.e. specialization at runtime?
评论 #22935085 未加载
stackzeroabout 5 years ago
+1 enjoyed how accessible this write up was
brokenbotnetabout 5 years ago
Really great.