5 ms·
Hmmm... Lets see the HN Reader example then... 95MB for the macOS DMG. 177MB for the actual example app. For a typical hello world application like the HN ex
by rvz 7y ago
Hmmm... Lets see the HN Reader example then...
95MB for the macOS DMG.
177MB for the actual example app.
For a typical hello world application like the HN example, it appears that it would be no better than running an electron-made version given that they both include their own versions of their respective runtimes. In this case, this includes the entire Java runtime which Clojure needs to run.
I think I would be better off with using either C++ with Qt5 or even FreePascal with the Lazarus IDE for this instead.
- mister_hn 7y agoAs suggested in the article, the usage of jpackage comes with a lot of drawbacks: - still a JRE is shipped (you MUST tailor it to the bare minimum with the flags) -> can be + ~30-40MB - OpenJFX/JavaFX relies on Qt (especially for the WebView) -> can grow up to + ~70MB - all the legal documents and docs are shipped together (you have to remove them with a post-process script) -> + ~5-10MB Using JVM for desktop apps is expensive in terms of space. Time can be reduced consistently thanks to the graal native compiler, but still a C++ project outperforms Java GUI applications by 500%
- pjmlp 7y agoOpenJFX/JavaFX uses WebKit for the WebView, Java never had any dependency to Qt. https://github.com/openjdk/jfx/blob/master/modules/javafx.web/src/main/native/CMakeLists.txt https://github.com/openjdk/jfx/blob/master/modules/javafx.we... I wonder where that 500% number came from, and yes C++ does blazing fast against Java in micro-benchmarks, except that on project delivery, developer salaries, time to market, additional costs for bug fixes (including memory corruption ones), available libraries, hardware costs for build performance also play a very big role.
- mister_hn 7y agoIndeed but Java Isn't that better compared to C++ when it comes to all those factors. There aren't memory corruption bugs, but the average number of Null pointer exceptions in fairly big projects can be daunting and relevant. Of course, Rust and Go here a big game changers in this way
- pjmlp 7y agoSince we are speaking about desktop apps here, Rust and Go still have to offer something that is half as good as Swing, including graphical design tooling.
- billfruit 7y agoI thought Rust desktop UI framework/libraries etc are still very much a work in progress.
- pjmlp 7y agoExactly, which is why "Rust and Go here a big game changers in this way" doesn't apply in this context.
- mister_hn 7y agogive them some time. And there's a Go API bridge for Qt
- pjmlp 7y agoSo the proposition to have a better UI done in Go to beat Java is to use C++. Well, I can also call C++ from Java. In fact, once upon a time Qt had official Java bindings.
- billfruit 7y agoI agree with you, having a poorly documented qt binding which may break on any update is not the ideal way for a modern language to have GUI functionality. Java is good in the sense that it has JavaFX, a modern and rather full featured GUI framework available for it. Rust, Go, etc is very far from being recommended for production desktop apps with GUIs.
- mister_hn 7y agoUntil Java 9, openjdk was requiring Qt 5 for OpenJFX because of the WebView, I clearly remember that. Still, shipping WebKit is pretty consuming
- pjmlp 7y agohttps://docs.oracle.com/javase/8/javafx/get-started-tutorial/jfx-overview.htm https://docs.oracle.com/javase/8/javafx/get-started-tutorial... > A web component that uses WebKitHTML technology to make it possible to embed web pages within a JavaFX application. Qt was indeed there, just like Gtk, EFL and every other plaform that is part of the WebKit source code vendoring inside the Java source code tree. http://hg.openjdk.java.net/openjfx/8/master/rt/file/f89b7dc932af/modules/web/src/main/native http://hg.openjdk.java.net/openjfx/8/master/rt/file/f89b7dc9... Which doesn't imply that the native code shipped with Java has any trace of Qt inside of it. https://www.oracle.com/java/technologies/javase-jdk8-downloads.html https://www.oracle.com/java/technologies/javase-jdk8-downloa...
- solarkraft 7y agoConsider my mind a little blown, however this seems to suggest that it's no longer the case: https://github.com/javafxports/openjdk-jfx/pull/48 https://github.com/javafxports/openjdk-jfx/pull/48
- pjmlp 7y agoIt was part of the WebKit vendoring and build process, as you can see in the source code, but it wasn't shipped with the JVM. http://hg.openjdk.java.net/openjfx/8/master/rt/file/f89b7dc932af/modules/web/src/main/native/Source/WebKit http://hg.openjdk.java.net/openjfx/8/master/rt/file/f89b7dc9...
- thu2111 7y agoGraal won't make apps run faster. The responsiveness of most Java desktop apps isn't CPU constrained, like on the web, slow reactions come from elsewhere. On the web it's mostly the heavy reliance on the server to do basic tasks meaning there's roundtripping. On desktop apps it's mostly like on mobile - if you hit disk or do other slow operations from the GUI thread then you can get "jank".
- pjmlp 7y agoAndroid here took a good approach actually, since developer education and lint checks apparently weren't enough, eventually Google changed the OS to kill an application that does such requests on the main thread.
- solarkraft 7y agoI tend to think rigorous constraints are important to achieve software quality because when something stupid is possible someone's going to do it ("what's the problem? it works").
- karatestomp 7y agoOn the web it’s mostly putting JavaScript between input and reaction/output, leading to input lag, and devs paying no attention to how much memory all those convenient JS data structures will eat and how slow it is to do stuff to them over and over. A few ms here, a few there, a ton of objects and lots of string concatenation, and boom, you’re using 1.5GB and your app feels slow as hell.
- ilikehurdles 7y agoKind of surprising then that not a single major 3D, music, office, or photography production software is opting to use web technologies for the GUI on the desktop.
- sdegutis 7y agoI wonder if something like https://github.com/zserge/webview https://github.com/zserge/webview but using Lua for the backend side (to avoid the need to recompile it) would be lightweight in just the right ways while still being (almost) as good as Electron?
- vlaaad 7y agoThis example might not be the best with regards to application size because it's main purpose is to show that packaging is now easy. As you can see in the app itself or on the screenshot, it also includes browser to render linked pages — but that can be excluded if the size is a concern.
- deleted 7y ago[deleted]
- positr0n 7y ago~5 seconds from double clicking the app to the window appears (and starts to load HN) on my 2019 MBP. I think this is a really cool library. I use clojure daily and love it. But this app isn't a very compelling demo over electron atm.
- vlaaad 7y agoStartup time can be made more or less instant with AOT-compilation of Clojure which is out of the scope of the example — it's purpose is to show packaging capabilities.
- StreamBright 7y ago>> I think I would be better off with using either C++ with Qt5 or even FreePascal with the Lazarus IDE for this instead. Or many other things. Not sure why are we so afraid to develop native applications with minimal overhead. V and Zig is going this direction.
- mark_l_watson 7y agoGood point. Lately I have been learning Swift and SwiftUI and application sizes for macOS and iOS tend to be very small. Except for not being a lazy evaluation language, Swift development feels a little like Haskell, which to me is a good thing. I learned Swift back when TensorFlow for Swift was released and having one language that is adequate for many types of applications is useful. That said, when I want to be happy programming I try to use Common Lisp or Racket. I am approaching my 40 year anniversary for using Common Lisp and there is definitely something really great about deep familiarity with a language and it’s dev tools. EDIT: also +1 for FreePascal. Someone hired me to use FreePascal on a project several years ago. Good language, small learning curve, and small and efficient applications. On small application sizes: I recently discovered that if you build SBCL Common Lisp from source, there is a compression option for building standalone applications that you can enable that gets application size down to about 15 MB, with application startup around 75 milliseconds.
- didibus 7y agoInteresting, but I wonder if Swift and Swift UI isn't cheating, since I'd assume most of their runtime is already present on iOS and macOS for them to link against. This is also often true of all these "native" solutions. It's more that the toolkit and the runtime is bundled into the OS they target, where as Electron or Java apps bundle absolutely all their dependencies including their own runtime. Though with Java, I think you could assume the user would install those separately, and you could just to use the existing ones.
- ken 7y agoThose other systems don't have Reagent. Reagent is simply the best way to write user interfaces I've seen in 25 years, bar none. The only comparable jump in productivity that I can recall is moving from assembly language to a compiler. Spending time with a profiler, we can probably improve the size and speed of a Clojure application (I've never tried using it for desktop software). No amount of time playing with Qt/Lazarus is going to give you Reagent, though.
- jtth 7y agoI'm confused. Clojure doesn't have Reagent either. ClojureScript does. And Reagent is a pretty straightforward React wrapper, not so different from Rum. What do you think makes it special? Even Rum renders server-side.
- didibus 7y agoThe author of the post is the creator of cljfx https://github.com/cljfx/cljfx https://github.com/cljfx/cljfx which basically allows you to use the reagent model to build JavaFx GUIs. I believe that is what parent is referring too.
- jcelerier 7y agoSo, you are saying that this : (ns example (:require [reagent.core :as r])) (def click-count (r/atom 0)) (defn counting-component [] [:div "The atom " [:code "click-count"] " has value: " @click-count ". " [:input {:type "button" :value "Click me!" :on-click #(swap! click-count inc)}]]) Is better than this : import QtQuick.Controls 2.3 Button { property int count: 0 onClicked: count++ text: count == 0 ? "Click me!" : "The value is : " + count } ? (testable here : https://tinyurl.com/rjgcfod https://tinyurl.com/rjgcfod)