

Ask HN: which of JavaScript's features slow it down the most? - yangjerng

I'm trying to sketch out a spec for a "restricted JavaScript" which throws out a few features, and in return compiles to much faster machine code. I'll get the ball rolling:<p>1. Throw out dynamic typing.
2. ... (your answer here)
======
phihag
Dynamic (prototype-based) typing is so fundamental to JavaScript that you'd
have to throw out so much that the resulting language wouldn't bear any
semantic resemblance to JavaScript. Additionally, interpreters have evolved in
the last decade.

Finally, ECMAScript Harmony (~ the next version of JavaScript) may have type
annotations like var x:Number;

Why don't you design a new language from the ground up? If you want, you can
make it look like JavaScript. Bear in mind that it must be faster to execute
than JavaScript, and easier to write code in than, say, C++, C#, or Java.

~~~
yangjerng
Here I'm really interested in lowering barriers to mathematical education.

Target:

I'd like to see created for the JavaScript community, an equivalent of the
Python-based/linked scientific and high-performance computing libraries (great
lists of which are available at <http://sagemath.org/download-packages.html>,
<http://wiki.python.org/moin/NumericAndScientific>). And I want that, because
I'd like to make it easy for people who learn JavaScript to get into
scientific and numerical computing without having to learn Python (& company).
(I know it's easy to learn Python, as I basically did it at some point, but
this suggests that perhaps it'll be easy to compile some restricted subset of
JavaScript to Python.)

Hypothesised method:

I'm primarily interested in a new language with minimal difference from
JavaScript, because the market ("human compilers") I'm targeting are
programmers who already know JavaScript. What I want to target those people
for, is to give them a minimally different language in which to write code
that compiles to faster C, in the manner that RPython and Cython do for
Python. I'm willing to throw out a lot of JavaScript features, I just want to
be careful to add a minimum number of features back in. I'll definitely be
looking at Lua, Dart, ECMA Harmony (which has no formal date of release, or am
I mistaken?), etc. as these are all close resemblances to contemporary (2012)
implementations of JavaScript.

Questionable Motivations:

I'm personally willing to learn any language/toolset that gets things done
faster (I'm learning Erlang myself, for this), but here, I am specifically
interested in lowering the bar (sorry) for other people who may not have such
willingness. This is just one of those "want to have my cake, and eat it too,
so I am putting some time into researching the problem" situations. I have
very limited prior experience in computer language design, but so far from a
hacking-the-ecosystem point of view, the problem seems interesting enough to
study, so, I hope to be doing more of that soon.

~~~
Someone
_"I'd like to make it easy for people who learn JavaScript to get into
scientific and numerical computing without having to learn Python ( &
company). (I know it's easy to learn Python"_

I don't like artificial barriers, but I also think the group of people who
could "get into scientific and numerical computing" and for whom learning
Python would be even a minor stumbling block is infinitively small. I also
think that the world would be better of if those for whom that would be a
stumbling block did not "get into scientific and numerical computing". Because
of that, I advise you to reconsider whether doing this is worth your time.

------
bdg
eval and which bog down everything.

