Wow - we're on Hacker News again! Hello all, and thanks for the link and discussion! While we're here, we recently made some stats public: <a href="https://stats.compiler-explorer.com/" rel="nofollow">https://stats.compiler-explorer.com/</a> (spot the Hacker News spike!)<p>General stuff: we're always looking for help; everything's open source on GH: <a href="https://github.com/compiler-explorer/" rel="nofollow">https://github.com/compiler-explorer/</a> (the base project, our cloud setup, all our build scripts, etc). The most valuable way to help us is with issues and PRs, or hang out on our Discord (<a href="https://discord.gg/zNNgyRKh" rel="nofollow">https://discord.gg/zNNgyRKh</a>). Then spread the word, and last we welcome sponsors on GH (<a href="https://github.com/sponsors/mattgodbolt" rel="nofollow">https://github.com/sponsors/mattgodbolt</a>) or Patreon (<a href="https://www.patreon.com/mattgodbolt" rel="nofollow">https://www.patreon.com/mattgodbolt</a>).
A small tip when visiting godbolt: you can use the name of the language you're interested in as a subdomain, to get a page immediately set up for that language, rather than starting with the default C++. For example <a href="https://erlang.godbolt.org" rel="nofollow">https://erlang.godbolt.org</a> or <a href="https://rust.godbolt.org" rel="nofollow">https://rust.godbolt.org</a>
When I was still programming in C++ that tool was <i>the</i> method to discuss compiler internals and language semantics with colleagues. Just setup a minimal example and share it with your colleagues. Impressive and sad at the same time. Impressive for obvious reasons. Sad, because the language is so confabulated that there is no easy concise way to talk about its semantics.
I've used Compiler Explorer for many years as a C++ developer. When I started working in HIP, I really missed having Compiler Explorer in my toolbox. I've been on leave for the past couple months and I took the opportunity to make some contributions outside my normal work. Consequentially, full support for compiling HIP to AMDGPU assembly was merged last week.<p>Here's an example:
<a href="https://godbolt.org/z/qjsErWzcs" rel="nofollow">https://godbolt.org/z/qjsErWzcs</a>
It's great that you can now get RISC-V output. IMO RISC-V is the most pleasant way to learn assembly-level programming. For anyone interested here's a nice resource:<p><a href="https://riscv-programming.org/book.html" rel="nofollow">https://riscv-programming.org/book.html</a>
I've used Godbolt for years.<p>The story that I heard, was that he was arguing with someone about some compiler optimization, and created the site to prove a point.
WOW!<p>There is a noscript/ basic (x)html version AND it does handle the _canonical_ gcc aka the last C compilable gcc (4.7.4).<p>Many of the optimization tricks hidden deep into those massive and complex software will be yours now.
I recently learned that it's not too difficult to run Compiler Explorer locally on your machine. Clone it from github and run the appropriate makefile and npm commands. Recently I've been using it Compiler Explorer a lot like this. It's easier to use your own header files and it's nice to not have the extra latency of compiling remotely or worry that you're using so many of their CPU cycles. The main downside is that if you run locally you can only test on the version of gcc and clang that you have installed, while on the website you can test other versions and also other CPU architectures.
A decent interview with the creator in podcast form.<p><a href="https://cppcast.com/matt-godbolt-compiler-explorer/" rel="nofollow">https://cppcast.com/matt-godbolt-compiler-explorer/</a>
Awesome tool. I do mostly c++ all day and I use this almost daily, and certainly weekly. I think it’s really improved my feel for what the compiler will do with different constructs.
I'd like to share a command-line tool to interact with Compiler Explorer that I made: <a href="https://github.com/xfgusta/cexpl" rel="nofollow">https://github.com/xfgusta/cexpl</a>. It's written in Python and it's available on PyPI.
Seriously asking, how is it even possible to submit this to hn at this point? When one submits a previously submitted link, doesn't it just alias to the previous submission?
Compiler Explorer is such a wonderful tool. It made examining and comparing compiler outputs so much easier and now pretty much everyone interested in optimizations is using it.
I'm looking at the C maxArray example and see that the for loop:<p><pre><code> for (i = 0; i < 65536; i++)
</code></pre>
gets compiled as<p><pre><code> .L2:
add rax, 8
cmp rax, 524288
jne .L4
</code></pre>
Is there any fundamental reason why the loop increments with 8 instead of 1? Or is this completely arbitrary? Thanks.
I just discovered goldbolt aka compiler explorer via this excellent podcast episode: <a href="https://corecursive.com/to-the-assembly/" rel="nofollow">https://corecursive.com/to-the-assembly/</a>
Is there a trick to make the typescript compiler run? All the other examples seem fine out of the box. No matter what I write, the ts compilation fails.
Its better than the others but also very unprofessional as the other web stuff. It DOES link but its absolutely impossible to view generated map. People are just hyping about codegen related microoptimizations but don't care about layout at all.<p>Very typical for today's world where javascript coder counts as software engineer.