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.

Kotlin doesn’t need an LLVM backend (2016)

80 pointsby bmaupinabout 8 years ago

17 comments

mike_hearnabout 8 years ago
Since I wrote this article Kotlin Native has been released, and you can read about it here:<p><a href="https:&#x2F;&#x2F;blog.jetbrains.com&#x2F;kotlin&#x2F;2017&#x2F;04&#x2F;kotlinnative-tech-preview-kotlin-without-a-vm&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.jetbrains.com&#x2F;kotlin&#x2F;2017&#x2F;04&#x2F;kotlinnative-tech-...</a><p>It features some interesting language support for C interop, an LLVM backend, and a reference counting+cycle detecting garbage collector. I wish the team the best of luck with it!<p>Meanwhile, I&#x27;ve been working on the tool I suggested in the blog, that uses Avian to create small self-contained binaries easily. For people who like using Go to make command line utilities and the like, Avian+Kotlin could be a very nice alternative. For high throughput servers you are still best sticking with the JVM, in my view.
评论 #14240806 未加载
vvandersabout 8 years ago
&gt; Unreal Engine is written in C++ and has used a core garbage collected game heap since version 3. It powers many of the worlds AAA titles. They can hit 60 frames per second and they are using a very basic GC.<p>This is actually very false. Yes they use GC but they also drop 2-3 frames at each 30s interval because that&#x27;s when the GC runs.<p>Go boot up Gears of War and let a character sit idle with no action, you can set your watch on 30s spans by the obvious frame hiccup. UnrealScript was great for prototyping and empowering designers but I wouldn&#x27;t hold it up as an example of a high performance runtime.
评论 #14240023 未加载
评论 #14240712 未加载
评论 #14242121 未加载
DannyBeeabout 8 years ago
Graal is pretty brand new in the relative scheme of things, it&#x27;s not going to be amazing out of the box. (I&#x27;ll ignore the &quot;LLVM has a JIT&quot; part)<p>Really. There is no magic here. The way you get compilers with 100% or greater perf of gcc&#x2F;llvm is not through silver bullets. It&#x27;s through a large amount of hard work and tuning. IE hundreds of person years.<p>It&#x27;s usually easy to get the first 60-70%, and then people say &quot;see, we didn&#x27;t need &lt;heavyweight thing&gt;, we&#x27;ll beat them with &lt;lightweight thing&gt;&quot;. But if you have customers where no performance is ever &quot;good enough&quot;, getting that 30%, and eventually beating other compilers, is the thing that takes 10+ years. You&#x27;ll never do it with &lt;lightweight thing&gt;. That&#x27;s why all these folks who try eventually end up with 3 layers of compilers, etc.<p>If it could have been done with &lt;lightweight thing&gt;, it would have been done that way.<p>Also, you can just about always transfer the metadata necessary to do high level optimization x at a lower level. it just may not be efficient to do so.<p>Conversely, compilers that focus on fairly high level optimizations often do a bad job at lower level ones :)<p>Again, tradeoffs, tradeoffs. (This is why, for example, swift&#x2F;rust&#x2F;etc have some higher level IR, do what they can, and hand the rest off to llvm).
评论 #14242517 未加载
4bppabout 8 years ago
I don&#x27;t understand why these &quot;people who want to do things without the JVM are wrong and deluded&quot; articles never seem to even acknowledge that not everyone might want to go through the trouble of installing and configuring a JVM to begin with (and so the comparison they make is between &quot;compile and run native code&quot; and &quot;compile and run java -jar soandso&quot;). Being on an apparently second-class platform (Linux), every forced encounter with GUI-enabled Java applications in recent memory for me (Mathematica, MATLAB...) resulted in having to spend days picking apart esoteric JVM issues to do with everything ranging from hardware acceleration to font rendering to native library interfaces which apparently keep popping up every year in such a way that the previous year&#x27;s Stack Overflow fixes no longer do anything.<p>Adding to that the hairiness of having to deal with concurrent versions (often the system&#x27;s versus what was included with the software package) and how even distro-official JRE packages usually follow the &quot;postinst script executes installer, installer downloads a blob and covers the whole system in untracked goo&quot; format, I&#x27;m usually very relieved to scrub my system of all traces of Java after I am done with whatever forced me to install it.
评论 #14242131 未加载
评论 #14242454 未加载
评论 #14242220 未加载
weberc2about 8 years ago
I don&#x27;t think the author did a particularly good job of addressing the points about startup time or memory size.<p>In particular, I think the argument about memory consumption is that it&#x27;s independent of compilation strategy, but rather it depends on the quality and tuning of the garbage collector. An AOT compiled program that uses the default JVM GC with default tunings will not see much better memory performance (unless the memory consumption is dominated by the JIT).<p>On the other hand, I think the &quot;AOT improves startup times&quot; argument is a good one, and the author&#x27;s explanation was unsatisfactory: AOT Java programs don&#x27;t start any faster than JVM programs. What is the methodology for testing? Is he using the later-mentioned Avian? Because that tool deliberately trades startup time for small binaries (via compression). Even if he isn&#x27;t, it&#x27;s likely a matter of tool maturity--there&#x27;s no fundamental reason an AOT Java Hello World should be slower than a golang hello world (which clocks in at 50ms on my machine compared to 130ms for JVM). Also the author implies that startup times only matter for tiny unix tools--I&#x27;d like to counter with a practical example: Gradle is so slow to start up that it&#x27;s been daemonized. I don&#x27;t know if this satisfies the author&#x27;s characterization of &quot;tiny unix tools&quot; or not, but clearly start up times matter.
评论 #14240224 未加载
phreackabout 8 years ago
It&#x27;s such an utter shame that Microsoft got to buy out and then abandon RoboVM (presumably because they felt it a threat to their recently acquired Xamarin). The one issue the author considers the most valid, was pretty decently solved almost a year ago-- I had made a couple little games that worked incredibly well out of the box in both iOS and Android on the same Kotlin codebase, it was a pleasure.<p>Luckily, RoboVM was forked after a while and it is being actively maintained by MobiDevelop [1], so give it a try if you&#x27;re into Kotlin, that scene deserves a lot more love.<p><a href="http:&#x2F;&#x2F;robovm.mobidevelop.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;robovm.mobidevelop.com&#x2F;</a>
评论 #14243006 未加载
评论 #14240685 未加载
eikenberryabout 8 years ago
Straw-man article. The main problems with the JVM in my experiences are the slow startup, large memory use and added cognitive load. The first one he says doesn&#x27;t matter, the second he never addresses directly and the third he completely misses.
评论 #14240194 未加载
评论 #14240236 未加载
outworlderabout 8 years ago
&gt;This impression is heightened by the fact that some well known garbage collected apps are written by people who just don’t seem to care about performance at all, like Minecraft or Eclipse, leading people to blame GC for what is in reality just badly written code.<p>This assertion is too harsh. Eclipse does seem to be over-engineered(speaking from the point of view of someone who had to write a proprietary plugin for it) and Minecraft does seem to run slow on even the latest machines (compared to AAA games).<p>But Minecraft is not a trivial program to write, despite fooling people with low-resolution textures. it is, &quot;algorithmically speaking&quot;, out of reach of many people, including those with a reasonable computer science background. I dare someone to do better (on the JVM!)<p>On a personal note, I cringe every time I have to go to a kid&#x27;s computer and modify &quot;-Xmx&quot; settings. I&#x27;m running a game, I want it to have all available resources not otherwise allocated to the OS, just like almost every other game there is.
评论 #14240443 未加载
评论 #14242443 未加载
dom0about 8 years ago
&gt; Worse, native CPU code is a lot larger than JVM bytecode.<p>&gt;<p>&gt; [Goes on to show how Hello World is <i>just</i> 1 MB, which is smaller than Go&#x27;s Hello World]
评论 #14239863 未加载
评论 #14242810 未加载
评论 #14239732 未加载
评论 #14239581 未加载
评论 #14239625 未加载
评论 #14239603 未加载
评论 #14240089 未加载
kristianpabout 8 years ago
Off topic comment here about Medium&#x27;s &quot;open in app&quot;, on mobile which can&#x27;t be dismissed [1]. It&#x27;s so infuriating that it sticks out over the text and has no way of being closed.<p>No I&#x27;m not going to install your app!<p>[1] <a href="https:&#x2F;&#x2F;imgur.com&#x2F;a&#x2F;81hky" rel="nofollow">https:&#x2F;&#x2F;imgur.com&#x2F;a&#x2F;81hky</a>
djsumdogabout 8 years ago
I remember the old gcj (GCC&#x2F;Java native backend) being terrible years ago (as far as performance). I haven&#x27;t looked at it since.<p>I agree with a lot of points in this article. The JVM does a lot of nice stuff for you. One of the big, non discussed, advantages of compiling to native would be removing the JVM dependency (and hence the dependency on openjdk or the terrible Oracle JVM license).<p>As far as LLVM, I&#x27;ll agree it&#x27;s a technologically impressive. Still, I feel a clear tech implementation was only partially the motivation, and the other was getting away from GPLv3&#x2F;FSF licensing. That bothers me a bit. I like the GPLv3, but I feel much of the industry wants to distance itself from the licensing that essentially helped pull Linux into what it is today.
评论 #14239518 未加载
评论 #14239647 未加载
bsaulabout 8 years ago
Isn&#x27;t one reason for supporting an llvm backend to be less dependant on Oracle ?
评论 #14239790 未加载
mhh__about 8 years ago
Questions: &quot;Many optimisations that can really help high level managed languages like Kotlin simply don’t apply to C++&quot;: Which optimisations?<p>&quot;Larger code bloats downloads and uses more RAM, lowering cache utilisation&quot;. This depends on your definition of cache <i>utilisation</i>: The code gets compiled, regardless of whether it&#x27;s AOT or JITed, therefore the cache gets used anyway?
评论 #14239629 未加载
tmztabout 8 years ago
Would something derived from Rust&#x27;s HIR&#x2F;MIR make a good target for other compiled languages, maybe with lessoned memory safety for some basic blocks.
评论 #14241467 未加载
评论 #14240576 未加载
relics443about 8 years ago
First thing I thought of when I saw the article title was Androids runtime switch in N. Glad to see the author include it.
hexmilesabout 8 years ago
i used avian in the past for some small project, it was a bit complicated at first but i like it in the end. I would love some integration in ide like intellj and build system
tbezmanabout 8 years ago
This article pretty much summed up everything I thought I knew. LLVM is still pretty fucking sick though.