4 ms·
I think Cringley is setting up a false dilemma here: that you can have fast or high-level but not both. Lisp has been fast for decades, and modern Common Lisps
by Zak 15y ago
I think Cringley is setting up a false dilemma here: that you can have fast or high-level but not both.
Lisp has been fast for decades, and modern Common Lisps are roughly the same speed as Java. Lua is a lot like Ruby or Python but about an order of magnitude faster. LuaJIT is another order of magnitude faster, putting it on the same level as Lisp and Java. Haskell is a very different sort of high-level language, but it's fast too.
I think he's right that we'll see more people caring about the speed of the implementation language's runtime, but I suspect we'll see more startups picking fast high-level languages or fast runtimes for already-popular high-level languages than going for Java.
- deleted 15y ago[deleted]
- Zak 15y agoWe could say that, but since LuaJIT isn't the default implementation, it's important to specify or people doing fact-checking might reasonably point out the claim as an error. Edit: the deleted post said, essentially "Why not just say that Lua is as fast as Java?".
- tomjen3 15y agoOne of the things Lua was designed to do was to be easy to embed. You don't necessarily want to embed a JIT compiler too.
- mattmanser 15y agoLet's be honest though, there's 0% chance of functional languages becoming mainstream in web development.
- rbanffy 15y agoThe canonical way to program for Node.js is very functional.
- burgerbrain 15y agoI would counter by pointing out that while that is true, the sorts of programmers who might use Node.js are dwarfed by the armies of incompetent untrained PHP developers out there. The HN crowd doesn't really give you a good window into reality in this case. I also don't think that languages should worry about becoming "mainstream" for exactly that reason...
- rbanffy 15y agoVery true. Being mainstream also means the language is used for stuff it really shouldn't be used for.
- Zak 15y agoOf the languages I mentioned, only Haskell is functional, though I'll concede that Common Lisp isn't very likely to become mainstream either. Lua, on the other hand is a relatively procedural scripting language. It can support functional programming if you want (it has closures and tail-call elimination), but that isn't the default. It doesn't even have map/reduce/filter in the standard library (I think it should). I also dispute your claim fundamentally. Research-oriented languages like Haskell probably won't go mainstream, but a mostly-functional paradigm is very natural for web development. A GET request is naturally a pure function (it takes an HTTP request and returns a page). A POST can often be purely functional except for the bit at the end where it creates, updates or deletes a value. Languages and frameworks that encourage that style of thinking make it much easier to avoid creating a complex monstrosity.
- Cloven 15y agoThis is an unusual statement to make, because in practice in the last decade, Java-based solutions are nowhere near 100x as fast as Perl/Python/Ruby based solutions; in fact I've found them generally to be slower. The difficulty lies in defining what 'fast' means. It's possible that the JVM is more highly optimized than, e.g., the perl bytecode engine, but the highly abstracted Java libraries (FactoryFactories etc.) tend to be far less efficient and have larger memory footprints and significantly more stack-passing than the equivalent ruby/python/perl equivalents.
- Zak 15y agoThe JVM is fast, and the Java language is usually the fastest language on the JVM when code is written with speed in mind. The fact that people often do slow things with Java because it's hard to write extensible Java any other way (or because they just like overengineering) doesn't mean the language isn't fast. Personally, I think using Clojure is a great way to get speed in practice. Inner loops can be as fast as they are in Java (with ugly optimizations), and extensible idiomatic code is a light lighter weight.
- deleted 15y ago[deleted]
- bad_user 15y agoUnfortunately while the language matters, the ecosystem matters even more. It isn't enough that Java is fast -- if all the libraries you're using are slow. And if the libraries you're using are slow, maybe you're measuring the wrong thing ;) My biggest gripe with Java is that it is basically useless for anything other than big-scale web applications. And for those kinds of apps, many companies still go for C++. I mean really, for scripting the startup time makes you want to puke. For desktop apps, I've never seen a Java application that I liked because the GUI toolkits available are brain-dead, and because Java apps have this nasty habit of freezing the interface in response to user events. Also, all Java apps are freakishly huge in regards to memory usage. I've seen Python apps that are tolerable, but nerver Java. Eclipse, the golden example, makes me want to hurt myself. For small web apps you can get decent performance out of Python/Ruby/PHP on a 512MB VPS -- 200 reqs/sec at least is really not a problem. If you need more than that, it means you're successful, so why not throw money at it? What else? Android is using its own VM that's not-Java. This means you cannot use libraries that do bytecode manipulation, and is essentially what http://www.ikvm.net/ http://www.ikvm.net/ is doing on top of .NET or Mono. So in what cases does Java really bring value? Don't get me wrong; I would love to see Mono being popular for web apps for instance -- it's a kick-ass open-source VM, with performance mostly on par with Java, but using less resources and being a better citizen on Unix (kind of ironic if you think about the roots of Java).
- ArbitraryLimits 15y ago> Lua is a lot like Ruby or Python but about an order of magnitude faster I'm surprised to hear either of those statements, both that Lua is a lot like Python and that it's an order of magnitude faster. Now, the last time I seriously looked at Lua was for my master's thesis work about four years ago, so I'm willing to believe that my impression of Lua is out of date. However, my experience on using it for a medium-sized project was that it is nothing like Python. My procedure for programming is 1) think of semantic construct, 2) think of how to express this construct in this language 3) type it in My experience with Python is that step (2) is almost automatic - for whatever reason, every construct I'm used to using has a clear, terse expression in Python. And I've never spent an extended period writing Python, so I don't think it's because Python has really shaped the way I think. (The closest analogue to Python programming is using the STL in C++, in my experience.) With Lua I had exactly the opposite experience. Every time it came to step (2), it felt like what I wanted to say was almost expressible in idiomatic Lua, but not quite. It just felt like I was running a race with a 50 pound backpack the whole time. Every time I tried to write a Lua script, I'd eventually throw up my hands and write my program in Python instead. Now, it's certainly possible that I just never really understood Lua's paradigm that well, and that if I'd kept going I would eventually have reached enlightenment. I don't think so, though - tables just aren't that hard, oonceptually. However, the point is that, out of the box, Python gives me by far the least cognitive friction and Lua by far the most of any programming language I've ever used. I therefore have to strongly disagree that Python and Lua have much in common other than a small overlap in the niche they each fill. And as for the order of magnitude speed difference, I find that hard to believe. Again, my information may be out of date, but when I looked at it Lua converted all numbers to double precision floating point numbers internally, which dragged its integer benchmarks down quite a bit. (In fairness, I think that was the same time frame where Python could only use primitive integers for the numbers 0-99, and had to box everything else.)
- andolanra 15y agoLua is much faster than Ruby/Python/Perl/&c. It still doesn't get close even to the higher-level compiled languages like Common Lisp and Haskell, but e.g. the programming language shootout [1] makes it pretty clear that Lua is still a league above the other dynamic languages. For just a quick result, I tried timing just the Hello World program in Python, Ruby, and Lua, and while startup time isn't going to be the bottleneck of the world of modern web development, it's still a telling result: $ time python2.7 -c "print 'Hello, world'" real 0m0.107s user 0m0.080s sys 0m0.023s $ time ruby -e "puts 'Hello, world'" Hello, world real 0m0.338s user 0m0.030s sys 0m0.013s $ time lua -e "print('Hello, world')" Hello, world real 0m0.008s user 0m0.000s sys 0m0.003s That said, I kneejerk-ly agree with you about Lua being an awkward medium for expressing programs. I personally haven't ever gotten to the status where Lua was as natural as Python, but I have also used Python a great deal more, so I don't know if my attitude is attributable to Lua's design, or Python's plenitude of libraries, or merely the experience differential between the two. [1]: http://shootout.alioth.debian.org/ http://shootout.alioth.debian.org/ EDIT: Converted some tabs to spaces. (Nitpicky, I know.)