2 ms·
While I love scala, I have 2 concerns that have stopped me from using scala.js: 1) can I use typescript definitions to avoid writing everything myself? 2) how
by jiaweihli 11y ago
While I love scala, I have 2 concerns that have stopped me from using scala.js: 1) can I use typescript definitions to avoid writing everything myself? 2) how much bloat does this add to my app? (from overhead of standard libs and core)
- ramnivas2 11y agoThere is a way to transform a typescript definition to Scala.js facade (https://github.com/sjrd/scala-js-ts-importer https://github.com/sjrd/scala-js-ts-importer). As for the bloat, it isn't much. Compiled Javascript for our full-fledged app is about 180KB (gzipped) + external libraries such as React.
- sulam 11y agoDon't take this the wrong way, but I've been in the industry for a long time... and it amazes me that 180KB is considered not much... If I told you I had a way to remove 180KB from every page load, you'd be all over it. :)
- Scarbutt 11y agobut the 180KB is not downloaded on every page load.
- sulam 11y agoThat's good! :)
- spicyj 11y ago180KB is comparable to a medium-size image.
- Ciantic 11y agoYes you are right. Scripting time however can be massive, take for instance this hs.fi (Finnish daily), they have 354kB of JavaScript, but scripting time with Skylake 6700K is 1.13 seconds of the page load. With Q6600 it was 3.5 seconds. With latest chrome it's easy to measure scripting time as pie chart. Go to "Timeline" tab of developer tools and hit F5. (just few releases back one had to do it manually by starting timeline and stopping it.)
- girvo 11y agoSo few people seem to run a profiler on their Javascript nowadays. It's a shame, really, as the tools are very powerful!