Main menu:

Site search

Categories

Archive

OSQ: the next 5 languages for the web

In the evening at the OSQ retreat, we had some informal discussions about new scripting language designs and languages for mobile devices. The starting points for these discussions were (a) that scripting language programmers will soon want to use parallelism, and (b) that mobile devices will have uniprocessor performance at least 12x slower than laptops for the foreseeable future.

New JS VM techniques (like TraceMonkey’s) are getting us a 2-4x speedup compared to what we’ve been used to for a language like JS. Is that good enough for mobile? I don’t know. Bill’s results (in my last post) suggest that one way or another, we can get a further 2-3x, which might bring us to a 4-12x speedup compared to the old JS stuff. That might be good enough, or maybe not.

The next question in my mind is, if we want to someday use some new language to get a bigger speedup, what should it look like? The first thing is that it should have a reasonably good translator to JS, so that it can run on any browser, even if the fancy new language is not supported. After that, I think two interesting starting points are Ocaml and Lua.

Ocaml is a high-level typed language with lists, garbage collection, and a lot of other features to make life easy for programmers. The biggest problem is the types: many programmers seem to prefer untyped languages like Python and JS, and types make prototyping more difficult. The types are also a great advantage: they really help with reliability and performance: in shootout-type benchmarks, Ocaml achieves performance very close to C.

Lua is a scripting language in the vein of Python and JS with simple, well-documented semantics. This simplicity makes it possible to deploy a tiny Lua interpreter. It also helps with performance: Lua has a small, general set of hooks for metaprogramming, while Python and SpiderMonkey have several such mechanisms, which has a cost in complexity and performance. Also, Lua doesn’t include complex features like inheritance in the base language, which presumably makes it a lot easier to optimize property accesses.

A related question is how to expose parallelism. I tend to favor mechanisms that don’t share mutable state, such as DOM worker threads or map-reduce. One reason is that in scripting languages, property accesses are not at all atomic (they potentially require multiple hashtable lookups) so every property access has to be locked. Even with a lot of clever implementation, the locks are still pretty costly, and even for programs that are not actually concurrent: we think on the order of 10-30% in SpiderMonkey. (And Python TBMK still has the global interpreter lock, and the official recommendation is to use multiple processes as a better way of getting real concurrency.)

Parallelism is easier in functional languages like OCaml, because they don’t mutate state very much–mostly they just create new values and read them. Also, in a typed language, a property access is much more like a simple memory read, which is easier to make atomic, or atomic enough.

So, I would like to see at least 2 new web languages, which could be JavaScript dialects, evolutions of other existing languages, or something entirely new. The first, which might be called MiniJS, would be an untyped scripting language, which would be used for most applications. MiniJS would look like JS with simplified semantics (and no ‘with’ statement for sure) and support for concurrent programming. The other language, which could be called TypedJS, would be a typed functional language inspired by OCaml, Scala, and perhaps even the dreaded ES4. TypedJS would be used for applications with stringent performance and reliability requirements. The two languages should be able to communicate but I don’t think they need to be mixed freely: in fact, making them part of the same language would probably make it too hard for each language to realize its full potential.

Comments

Comment from Houston Top Doctors
Time: November 8, 2010, 11:02 pm

You’ve got a point there. Keep it going. It would result a very successful one.

Comment from le meilleur placement financier
Time: November 10, 2010, 5:17 pm

I was wondering what is up with that weird gravatar??? I know 5am is early and I’m not looking my best at that hour, but I hope I don’t look like this! I might however make that face if I’m asked to do 100 pushups.

Comment from Compression Spring Manufacturer
Time: November 10, 2010, 9:25 pm

I’d like to run Java/C# without an external VM. I guess google web toolkit may be the best thing for now.

Comment from Mesothelioma Attorney
Time: November 11, 2010, 4:07 am

Looks great and nice. I wish i could try it.

Comment from Bachelor In Psychology
Time: November 12, 2010, 4:32 pm

interesting discussion, am in learning about php language.

Comment from caribbean family vacations
Time: November 14, 2010, 5:10 am

TypedJS would be used for applications with stringent performance and reliability requirements.

Comment from terrain a vendre
Time: November 15, 2010, 5:07 pm

Vous avez un blog vraiment utile que je suis ici la lecture pendant une heure environ. Je suis un newbie et votre succès est beaucoup une source d’inspiration pour moi.

Comment from Grossesse Semaine Par Semaineg
Time: November 18, 2010, 1:12 am

I have missed this blog! Its incredible. Your design is flawless, like you know exactly what to do to do make people flock to your page! I also like the perspective you brought to this subject.

Comment from mens ties
Time: November 20, 2010, 8:29 am

The way you explain difficult things in easy words is excellent, i am learning alot, and very easy to understand.

Comment from cna certification test online
Time: November 21, 2010, 2:05 am

I like us to think about these languages can be used for general programming, not just on Web programming, and this means that the caliber of the standard Python libraries …. with JavaScript, the question still remains …. I’m still not sure what it means to GC, HOFs etc. In such circumstances, but I suspect that the camp would look at, thanks! BR, Karen from cna training

Comment from Embroidered shirts
Time: November 21, 2010, 9:50 pm

I like to your this new mobile language. Thanks for sharing this pretty article about this new pretty release of this language. I really like it. Thanks so lot.

Comment from face
Time: November 22, 2010, 5:39 pm

Interesting info, do you know where I can find similar information? I’ve been trying to find out a little more about this kind of stuff, thanks for sharing it.

Thanks so lot…

Comment from web hosting
Time: November 22, 2010, 11:55 pm

After our recent blogs about JägerMonkey, some articles out there gave the impression that we were removing nanobot, throwing everything away, or doing all sorts of other radical things that we are not in fact doing. I don’t have a huge problem with that–this is complicated stuff and it’s hard to get right.

Comment from zyprexa class action lawsuit
Time: November 23, 2010, 12:57 am

I high appreciate this post. It’s hard to find the good from the bad sometimes, but I think you’ve nailed it! would you mind updating your blog with more information?

Comment from ovulation symptoms
Time: November 23, 2010, 8:23 am

Runs down to the desired language. Java is the next big thing that I long so I do not remember. Here thank you for this interesting article. The people I’m really interested if the interest is high in the programming language. I read a couple of times I’ll read again. Thank you. ovulation symptoms