4 ms·
Java 10x faster than JavaScript, in 2023? No.
by crubier 3y ago
Java 10x faster than JavaScript, in 2023? No.
- bayindirh 3y agoI didn’t say faster, I said more efficient. They are two wildly different things.
- hutzlibu 3y agoThis seems to be such a pedantic discussion all around. Well, what did you mean by more efficient if not more performant, the usual metric? More efficient to develope? Possible, depending on the devs skill set, but hardly relevant for the end user who want to play the game on possible low performant hardware? Oh and I think wasm can beat java in several cases.
- bayindirh 3y ago> This seems to be such a pedantic discussion all around. No, as a high performance software developer, my aim was not to devolve the discussion into a pedantic "stone throw". > Well, what did you mean by more efficient if not more performant, the usual metric? Watt per instruction. IOW, power consumption. As a person who lives in HPC world, inefficiency is bane of my existence. Two software can be equally performant while having different power profiles. I'm focusing on power. What does this brings, you may say. Throttling is the simple answer. If you waste more power, you'll hit the throttling wall faster, use more battery, and will lower the quality of the experience. From your phone to biggest supercomputers have thermal budgets, and none of them are unhittable. > but hardly relevant for the end user who want to play the game on possible low performant hardware? Not all of us have latest processors, tons of RAM, and JS microbenchmarks show that browser JS engines have wildly different performance characteristics for some loads. Using a native platform pushes these concerns out of the picture. > Oh and I think wasm can beat java in several cases. Have no experience with that, need to test and see.
- hutzlibu 3y ago"Using a native platform pushes these concerns out of the picture." Well yes, but this project was made with java. And by now I don't think java is more performant or efficient than the browser. In general, as you are surely aware, if you are looking for the most efficient solution, than obviously neither java nor the web is the right plattform. But for a casual game, both is fine.
- chrisco255 3y agoRight, but efficient can mean a lot of things. Though Java was used, this game is inaccessible to Mac, iPhone, and Android users. Porting to all these platforms is inefficient compared to just using the web. It also requires a 60MB download, which is not very space efficient for a relatively simple 2D game (NES Tetris fit on a 24KB ROM). People have implemented Tetris in as little as 446 bytes [1]. Full color JS versions have been done at 16KB or less [2][3]. A JS version from 2004 came in at 1.5kb [4]. Haven't done memory efficiency analysis, but willing to bet the average JS Tetris implementation has dramatically better memory efficiency as well. [1] https://hackaday.com/2016/10/06/tetris-in-446-bytes/ https://hackaday.com/2016/10/06/tetris-in-446-bytes/ [2] https://github.com/cztomczak/jstetris https://github.com/cztomczak/jstetris [3] https://codeincomplete.com/articles/javascript-tetris/ https://codeincomplete.com/articles/javascript-tetris/ [4] https://joriszwart.nl/games/javascript-tetris-1.5kb https://joriszwart.nl/games/javascript-tetris-1.5kb
- bayindirh 3y agoMacOS has official Oracle and OpenJDK distributions. The author just didn't compile an executable for them, that's all. At least, I run Eclipse on macOS, which in turn uses platform Java. It's funny that when people say that hardware is cheap, but frown on a 60MB explicit download. Our browsers spend several 60MBs per day to show us ads, and we don't tell a word, but "a 60 MB game. Heresy!", we cry. I'm no stranger to hyper-efficient implementations as a demo scene enthusiast, yet this is no demo, and is a cross platform game, where the author decided to code in Java. I don't understand the criticism, because I'm aware of no rule that any software we develop shall run on Big5 (iOS/macOS/Android/Linux/Windows), plus web browser and my car key fob. Actually, when I look the files, the game is 20MB assets + 110K executable + 40MB JRE. So the developer decided to bundle the JRE to make sure it runs. That's a fair (even small) size given today's lassiez faire attitude where people chant "Hardware is cheap, network is reliable". Yes, one might do this in 100K altogether, but, personally, I'm no judge. It's a good game, runs on my favorite OS, and enjoyable. That's enough for me. If the idea is that good, let Setris clones show us the way.
- mslivo 3y ago
- chrismorgan 3y ago10× more computationally/power efficient while running? Not a chance. Assuming similar care put into the two, the two will probably be much of a muchness.
- junon 3y agoHeh? What world are we living in that Javascript is faster than Java?
- chrismorgan 3y agoNo one claimed that. All that was claimed was “not 10× slower than Java”.