News for hackers. Stuff that matters.
Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by onion2k on Monday September 12, 2016 @01:40PM (#12481820)
Poorly written websites can bring a desktop PC to its knees, but so can a poorly written native application. That isn't an argument against leveraging web technology so much as an argument in favour of well written applications. And at least with a chromeless-browser-pretending-to-be-application you have the protection of the browser process sandbox so an app that goes awry isn't going to take your computer down that badly.
Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by catnaroek on Monday September 12, 2016 @01:47PM (#12481895)
> Poorly written websites can bring a desktop PC to its knees, but so can a poorly written native application.

Even well-written Web applications tend to use more system resources than their well-written desktop counterparts. A few days ago, I was surprised to find that Chromium was using 6 GB of RAM, while all other processes combined (including three Emacs instances, running fancy modes) were using just 1GB. And, no, I wasn't playing browser games or doing anything fancy in Chromium: just viewing text and images.

> And at least with a chromeless-browser-pretending-to-be-application you have the protection of the browser process sandbox so an app that goes awry isn't going to take your computer down that badly.

It would be much better to use programs that don't need to run in a sandbox in the first place. (To be fair, OS-enforced memory protection can be considered a kind of sandboxing too.)

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by aikah on Monday September 12, 2016 @01:46PM (#12481883)
> That isn't an argument against leveraging web technology so much as an argument in favour of well written applications

The difference is there is very little room for optimisation in most javascript runtimes. They don't support multi-threading and the memory is impossible to manage. "Lower" level languages always allow better performance tweaking when necessary. Javascript allows next to none. You can't tell javascript :"Give me an array of 10 elements", or "give me a integer of that length". So no "headroom" for performances with Javascript.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by pcwalton on Monday September 12, 2016 @02:35PM (#12482395)
> They don't support multi-threading

Yes, they do, via Web Workers. They just don't support multithreading at the level of concurrent access to the DOM, and they don't support shared memory. Very few native libraries support concurrent access to UI widgets, and not many native applications make heavy use of shared memory for compute either. (Most native applications don't have heavy compute needs in the first place…)

> Give me an array of 10 elements

new Array(10)?

> give me a integer of that length

Uint8Array, Uint16Array, Uint32Array?

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by aikah on Tuesday September 13, 2016 @08:26AM (#12487492)
Please :

> Yes, they do, via Web Workers.

Which are not part of the javascript spec, it is DOM related. And web workers were never meant to increase performance. In fact in practice they don't, they often make code slower. They just guarantee that the UI thread will not block.

> new Array(10)?

Which doesn't allow any specific runtime optimization as the array can be resized at anytime

> Uint8Array, Uint16Array, Uint32Array?

Which doesn't give me an integer of a specific size BUT any array of integer.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by mmatants on Monday September 12, 2016 @02:13PM (#12482166)
Most performance problems with websites/webapps out there are just due to sheer nastiness of the shovelware that they embed. No need to have fine-tuned debugging and profiling when the main fix is "don't accidentally run this jQuery selector 1000 times on every click". Very low hanging fruit.
Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by BinaryIdiot on Monday September 12, 2016 @01:53PM (#12481972)
> the memory is impossible to manage.

Nonsense. There are plenty of strategies for managing memory efficiently in JavaScript. Yes you can't do a C++ level of allocation, decallocation, etc but you most certainly can manage the amount of memory your code uses.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by fenomas on Monday September 12, 2016 @03:02PM (#12482643)
This is a non-argument. Firstly, JS does indeed have typed arrays and other tools for managing memory. More importantly, unless you're doing 3D or similar it's vanishingly rare that the memory used by objects you've allocated in JS will be measurable compared to the memory used for DOM objects and rendering generally. Replacing JS with some other language wouldn't affect the memory usage of typical web pages.
Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by jaquers on Monday September 12, 2016 @01:54PM (#12481986)
I think the spirit of the argument is that if you have requirements for heavy computation such that you need multithreading + low level memory management, then you probably shouldn't use this. Use the right tool for the job. This is just one of them.

Plus there are alternatives to threads. Look at the state of Atom or VSCode. Much progress has been made in terms of perf and these are not trivial applications.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by dilann on Monday September 12, 2016 @02:00PM (#12482052)
> Use the right tool for the job

That's a funny argument in a thread about js. Js has started as a small language to do scripting on the pages, now they are sticking it everywhere.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by goatlover on Monday September 12, 2016 @02:51PM (#12482549)
Because people don't actually use the right tool for the job when it comes to software. Instead, they take the tool they know, ignore the better tools they would rather not have to learn, and make the known tool do things it was never designed for.

Excel is a great example of that, but it's done with programming languages as well.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by mrec on Monday September 12, 2016 @02:00PM (#12482046)
Slightly nitpicky, but while lack of support for multithreading might make a particular app slow or unresponsive, I'd have thought it makes it less likely for that app to be able to bring the entire system to its knees.