News for hackers. Stuff that matters.
Re:JavaScript is Eating the World by coldtea on Thursday August 24, 2017 @11:32AM (#15090912)
>If you're better with screwdrivers, why struggle with a hammer?

Hammers and screwdrivers are not general purpose tools in the way that languages are.

For most things, most languages are just as fine.

It's not like JS is specialized in some very small niche by design -- like e.g. COBOL is.

>JavaScript has a painfully slow runtime.

I call BS. v8 is one of the fastest dynamic runtimes, at 2x of C or so for lots of tasks, and it totally obliterates Python, PHP, Ruby, and co in speed. And since some of the web's different properties are written in the latter 3, it's certainly not speed (which JS surpassed them far in) that's the issue.

>If you want to make a toy service and don't care about any of this, go ahead and use your favourite language. But when you want to make something incredibly fast and reliable (like nginx), you'll need to consider another technology.

Nobody writes "nginx" in JS.

They write the kind of APIs and apps and services that people also used to write in PHP, Python, Ruby, Go and whatever lang.

Re:JavaScript is Eating the World by rootlocus on Thursday August 24, 2017 @03:44PM (#15093361)
> I call BS. v8 is one of the fastest dynamic runtimes, at 2x of C or so for lots of tasks, and it totally obliterates Python, PHP, Ruby, and co in speed.

Any proof for this?

EDIT:

According to "The Computer Language Benchmarks Game"

JavaScript fares pretty well against Python [1] or Ruby [2] but not really that great against C [3] or Java [4] in the CPU intensive benchmarks.

1 http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan...

2 http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan...

3 http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan...

4 http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan...

Re:JavaScript is Eating the World by coldtea on Thursday August 24, 2017 @05:25PM (#15094194)
>JavaScript fares pretty well against Python [1] or Ruby [2] but not really that great against C [3] or Java [4] in the CPU intensive benchmarks.

Considering is a non-static, totally dynamic language, with all kinds of dynamicity in it, it does totally fine. 10x to 30x faster than Python, Ruby etc, and 3x to 5x slower than C/Java is totally fast.

Re:JavaScript is Eating the World by thehardsphere on Thursday August 24, 2017 @02:49PM (#15092867)
> It's not like JS is specialized in some very small niche by design -- like e.g. COBOL is.

Uhh, what? You don't consider "programatically manipulate the DOM in the browser" to be a niche?

Re:JavaScript is Eating the World by coldtea on Thursday August 24, 2017 @05:21PM (#15094164)
There's nothing about JS as a language meant specifically to "programatically manipulate the DOM in the browser".

Anything it does related to that is just simple library code and methods on the "document", "element", etc objects -- and that's only when run in the browser where those are available (automatically "imported" let's say). Node doesn't even have the "document" object.

Re:JavaScript is Eating the World by pier25 on Thursday August 24, 2017 @03:24PM (#15093189)
Accessing the DOM is not really part of the language specification, but the browser API, no?
Re:JavaScript is Eating the World by thehardsphere on Thursday August 24, 2017 @04:16PM (#15093677)
And the "Browser API" was invented to do what, exactly? And by what mechanism was said API exposed to developers? And whose cocktail napkin was the specification written on?
Re:JavaScript is Eating the World by coldtea on Thursday August 24, 2017 @05:23PM (#15094179)
>And the "Browser API" was invented to do what, exactly?

Whatever it was inveted to do is totally irrelevant, as the "browser API" is not Javascript the language/syntax but just an API (library/module).

In fact you could trivially implement it in all kinds of programming languages.

Re:JavaScript is Eating the World by wolco on Thursday August 24, 2017 @06:34PM (#15094645)
Maybe against php 4. PHP 7 is much faster
Re:JavaScript is Eating the World by coldtea on Friday August 25, 2017 @03:17AM (#15096777)
It's just about 2x as fast as PHP5.

JS JIT were already many times faster than PHP5. There's no comparison to the complexity, quality, resources and top-notch teams in play in JS JITs (just consider the vendors making them: Google, Apple, Microsoft and Mozilla) and PHP.