3 ms·
"Just be aware that the size of the examples is quite big because no optimizations have been done to reduce the size of the binary JavaScript." The size is a
by k__ 11y ago
"Just be aware that the size of the examples is quite big because no optimizations have been done to reduce the size of the binary JavaScript."
The size is about 30MB, how much smaller would this get? Even a 50% shrink would be rather big.
- wiz21c 11y agoThere are still plenty of people who work behind a screen and a keyboard, with a hard disk of 500GB and connected to their LAN only... For those 30Mb is just nothing.
- k__ 11y agoI know. I write web-apps for such people. It still bothers me that things are getting so big :D
- wiz21c 11y agoLook at it this way : the future of technology is (most of the time) to help people accomplish necessary (or new) tasks in an easier way. As someone who likes to program, future is : - network with infinte bandwidth - a computer with infinite memory and infinte speed (or, even better, a future when the programmer is vital but doesn't have to write code anymore :-)) So don't bother, just wait for it :-) Having started programming on an Apple 2+ (64kb ram), I know what I'm talking about :-)
- k__ 11y agohaha, sounds like the answer to the question "Why do applications get slower with time?" is wiz21c ;)
- dragly 11y agoBlog post author here. I don't know how small it can become because I haven't looked into optimizing for size yet. However, we can look to the native Qt libs to get a ballpark answer to your question. I just tried gzipping the binary .so files of QtCore, QtOpenGL and QtQuick on Ubuntu and that takes up 3.9 MB. That is likely a theoretical lower limit of what needs to be downloaded by the user, but I don't think we can expect anything close to that after compiling to JavaScript. Perhaps WebAssembly will help reduce the size in the future. In any case, I wouldn't exactly recommend building a blog using Qt this way. If you want to try building websites with QML, qmlweb is much better suited. I rather expect Qt+NaCl/Emscripten to be useful for larger browser applications, like 3D graphics software, games, scientific simulators, and so on.
- flohofwoe 11y agoIn my experiments I found that gzipped asm.js is in the same ballpark as gzipped 64-bit x86 code. asm.js might come out 10..20% bigger, but not more. The absolutely important point is to make sure that the download is compressed (web servers typically do this for .js files). There is a static size overhead of up to a few hundred kbytes for C/C++ runtime code which needs to be included in the asm.js file, and which normally lives in system dlls when running as native code, but this can be optimized by trying to minimize the use of C++ (e.g. iostreams introduce quite terrible bloat, better to just use printf). A lot of work has gone into emscripten to optimize the output size, also very recently (e.g. a linker pass which scans the code for duplicate functions and removes them, which sometimes helps for code which makes heavy use of templates).
- deleted 11y ago[deleted]
- polymeris 11y agoWould dead code elimination be an option, if you are not using all of Qt?
- dragly 11y agoIn principle, yes, but I don't think Emscripten can do anything automatically the way things are now. The QML sandbox requires that almost all of QtCore and QtQuick is available because almost all code can be called by the user at runtime. Manually removing code you know is unused might be possible, though. I think I might have heard of some third-party tools that could help with this.