develooper Front page | perl.perl5.porters | Postings from November 2011

Re: RFC: Autoloading charnames

Thread Previous | Thread Next
From:
Tom Christiansen
Date:
November 23, 2011 09:54
Subject:
Re: RFC: Autoloading charnames
Message ID:
19256.1322070855@chthon
Jesse Luehrs <doy@tozt.net> wrote
   on Wed, 23 Nov 2011 11:27:27 CST: 

> Well, if nothing else, it's a potentially unnecessary use of
> ~500kb/process.

Ouch!  That's good enough for me.  Well, or used to be.  Guido
recently told the Python folks that having to load 500k of Unicode
properties to get regexes to work right on Unicode data didn't 
really bother him much, and I tend to agree with him.

Still, most people think nothing of loading in a megabyte of cruft to do
something just to get some syntactic sugar for already-loaded, built-in
functionality.  These are with v5.14:

openbsd% perl -e 'system "ps v$$"; require IO::Handle; system "ps v$$"'
  PID STAT       TIME  SL  RE PAGEIN   VSZ   RSS   LIM TSIZ %CPU %MEM COMMAND
 9539 S+      0:00.01   0   0      0  1244  1704 496036  940  0.0  0.3 perl -e system "ps v$
  PID STAT       TIME  SL  RE PAGEIN   VSZ   RSS   LIM TSIZ %CPU %MEM COMMAND
 9539 S+      0:00.06   0   1      0  1476  2580 496036  940  1.0  0.5 perl -e system "ps v$

That's +232 VSZ, +876 RSS.

openbsd% perl -e 'system "ps v$$"; STDOUT->autoflush; system "ps v$$"'
  PID STAT       TIME  SL  RE PAGEIN   VSZ   RSS   LIM TSIZ %CPU %MEM COMMAND
12282 S+      0:00.01   0   0      0  1160  1712 496036  940  0.0  0.3 perl -e system "ps v$$"; STDOUT->au
  PID STAT       TIME  SL  RE PAGEIN   VSZ   RSS   LIM TSIZ %CPU %MEM COMMAND
12282 S+      0:00.09   0   1      0  1468  2840 496036  940  4.0  0.5 perl -e system "ps v$$"; STDOUT->au

That's +308 VSZ, +1228 RSS.

openbsd% perl -e 'system "ps v$$"; $| = 1; system "ps v$$"'
  PID STAT       TIME  SL  RE PAGEIN   VSZ   RSS   LIM TSIZ %CPU %MEM COMMAND
 2575 S+      0:00.01   0   0      0  1244  1712 496036  940  0.0  0.3 perl -e system "ps v$$"; $| = 1; sy
  PID STAT       TIME  SL  RE PAGEIN   VSZ   RSS   LIM TSIZ %CPU %MEM COMMAND
 2575 S+      0:00.01   0   0      0  1244  1740 496036  940  0.0  0.3 perl -e system "ps v$$"; $| = 1; sy

That's +0 VSZ, +28 RSS.

I know, I know: it's "only" a megabyte, and legibility is more important
than performance.  Still.  I've occasionally wondered whether the compiler
could catch that as a special case, but I end up deciding it's not worth
the code bloat in the compiler source such a hack would require.  Never
stopped FORTRAN from optimizing its intrinsics though.  Adding cheats to
the compiler can be worth more than they appear to cost, because it's a
rising tide that raises all ships.  Look at all the compiler hacks for
detecting the standard Livermore Loops benchmark, for example.  Nobody
thinks those should be removed for truth and beauty.  I just wouldn't 
want to have to be the one supporting them.

--tom

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About