[SDL] Off-Topic: Quake II Ported to HTML5
david at olofson.net
Wed Apr 7 02:51:07 PDT 2010
On Wednesday 07 April 2010, at 02.28.41, Forest Hale <havoc at ghdigital.com>
> What worries me about languages like lua is that they use polymorphic
> objects for all variables, which inherently makes them hard to JIT - there
> is a luajit project but it has to inline large amounts of functions to
> have a good chance of recognizing variable types and turning operators
> into explicitly-typed operators, necessary for fast interpretation or JIT.
> There's never a good reason to make something slow, especially if it is a
> core element like a virtual machine for a scripting language, which might
> be running much heavier code than you ever dreamed of, especially
> considering how easy it is to make things fast.
Indeed, dynamic typing has performance issues, but it's one of those features
one expects to find in a *true* high level language. Basically, if you don't
need features like that, but you do need high raw performance, these languages
are not the right tools for the job! (And, as long as you're using a non-JIT
VM, instruction decoding seems to be *The* performance bottleneck anyway...)
That said, I have the same Lua style "all variables dynamically typed" design
in EEL, and so far, my experience is that although it's very handy in some
cases (like API design), actual code tends to either rely on values being of
specific or functionally similar types (ie "integer/real" or "indexable
container"), or explicit runtime typechecks are used for deciding what to do.
When it comes to actual work, true polymorphism is rare.
Maybe it's just EEL and my programming style that needs to evolve a bit?
Either way, I'm planning on adding static typing eventually, not only for raw
performance (it's quite fast enough for what I do already), but also for the
added compile time type checking potential. Catching lots of bugs right in the
compiler is a nice thing, and I want more of that in EEL! :-)
//David Olofson - Developer, Artist, Open Source Advocate
.--- Games, examples, libraries, scripting, sound, music, graphics ---.
| http://olofson.net http://kobodeluxe.com http://audiality.org |
| http://eel.olofson.net http://zeespace.net http://reologica.se |
More information about the SDL