Date: Mon, 11 Oct 1999 10:36:25 +1000
From: skaller <skaller@maxtal.com.au>
To: William Chesters <williamc@dai.ed.ac.uk>
Subject: Re: Stdlib regularity
William Chesters wrote:
>
> skaller writes:
> > No. This isn't necesarily the case. There are other
> > solutions. In C++, the philosophy is to provide as much protection
> > as possible, without costing at run time, and with protection
> > that does cost at run time being optional.
>
> Are you sure that initialising arrays etc. carries enough cost to be
> worth avoiding?
No, I'm not.
> After all, one of the two problems, namely the
> requirement to keep legal values in slots at all times, is quite easy
> to work around when you have to---my basic Vector is about 100 lines,
> generously spaced---while the other, performance, worry seems a priori
> likely to be misplaced, because if you are constructing an array then
> your time complexity is presumably at least k×n for some nontrivial k,
> so that the extra few instructions × n are unlikely to make a big
> difference to the overall program, however annoying they look "in the
> small".
>
> ocaml already goes some way beyond what C++ considers acceptible
> inefficiency. That's fine for a vast number of applications on modern
> desktop hardware.
Unfortunately, when writing an interpreter such as one for Python,
reasonable efficieny plus some other advantages seem neccessary
to get any users at all. JPython (Java implementation),
for example, is 3 times slower than CPython (C implementation),
and that was enough for me to discount it.
In fact, I am writing a python interpreter because CPython
is vastly (several THOUSAND times) too slow for what I need:
extremely fast string operations are required to support
Interscript, my literate programming tool. Example: Interscript
includes documentation for ISO10646 (unicode) characters,
the complete build of interscript itself, which is written
in interscript, takes several HOURS on my 120Mhz pentium:
the generated documentation is around 5Meg, mainly consisting
of the character code tables.
This is mainly because I have to do things like convert
a string or plain text to HTML, which requires replacing
characters '<' with '<'; that is, scan each individual
character .. in an interpretive loop.
It may seem strange to believe I can actually achieve this
performance in ocaml! But I do! Because of the 'higher level
algorithms are easier to write in ocaml than C' factor,
optimisations using techniques such as type inference,
special pattern recognition, etc,
and generation of fast C or assembler, are possible.
FYI the design is to use the interpreter only to load
the modules required for a main program, then do
whole program analysis to generate a single executable.
But because Python also has dynamic features like 'exec string'
it is necessary to make the interpreter available at run time,
even in the compiled code. So it needs to be reasonably efficient.
-- John Skaller, mailto:skaller@maxtal.com.au 1/10 Toxteth Rd Glebe NSW 2037 Australia homepage: http://www.maxtal.com.au/~skaller downloads: http://www.triode.net.au/~skaller
This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:26 MET