[Gllug] Linux workstation admin simpler than OS X
Richard Jones
rich at annexia.org
Sun Aug 2 10:41:00 UTC 2009
On Sun, Aug 02, 2009 at 10:20:06AM +0000, gllug at jameslaver.com wrote:
> I'm left to wonder if you've actually look at the perl internals, since
> it's the one that doesn't so that. Perl is actually surprisingly
> optimising, although it would rather waste memory to improve speed. The
> problem is that Perl is so dynamic that you can't make these guarantees
> universally. If you can play with the symbol table at will, you can do
> what you want. There are still ways around this, but it's a much bigger
> problem than you make out and perl of all of them is the one that does
> the most work at compile time.
Depends what you'd count as the real 'perl internals'. But I wrote
http://merjis.com/developers/perl4caml which uses a considerable
amount of perlguts.
If you're talking about the Perl compiler, then I don't have in-depth
knowledge of it. But I have used perl -Dx to examine the compiled
tree, and it didn't lead me to believe it was doing very significant
optimizations on temporaries.
> > As an example: all three languages will store, at runtime, the type of
> > every single variable, even short-lived temporary variables, and even
> > variables where it could be proven that the type will never be needed.
> > This is amazingly dumb, and no compiler written since about 1975 works
> > like this.
>
> Perl has a fixed set of types internally and storing what type it is is
> merely a matter of which pointer in the structure actually goes
> somewhere. Oh no, a couple of bytes. Big whoop
It's not "a couple of bytes". A Perl SV is 24 bytes, to store an 8
byte quantity (ie. a native int). So it's 3 times larger than it
needs to be. This overhead is entirely due to the reference count and
the type, neither of which is needed most of the time.
All your data is 3 times bigger than it needs to be. And you're
storing large parts of the AST and the symbol table at runtime (and
recursively for every library you 'use').
None of this is necessary.
> OCaml is awkward to do a number of things in and makes me want to spork my
> eyes out when i look at code written in it.
Like anything new, you have to learn it. Then you'll find the syntax
makes a huge amount of sense.
> I'm sure you think the same about Perl though.
I use Perl almost every day. In fact I'm writing a rather large
program in Perl at work right now. I miss the ease of writing stuff
compared to OCaml though.
Rich.
--
Richard Jones
Red Hat
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list