Un-Ouch

nicholas on 2005-12-23T11:34:25

Dan noticed that my estimates of the pain of POSIX were somewhat an under-estimate.

Anyway, all this started because I thought I'd figured out how to reduce it a bit. And it seems that I did.

Before
$ ./perl -Ilib -MDevel::Size=total_size -le 'use POSIX(); print total_size(\%::);'
247707
$ ./perl -Ilib -MDevel::Size=total_size -le 'use POSIX; print total_size(\%::);'
790956
After
$ ./perl -Ilib -MDevel::Size=total_size -le 'use POSIX(); print total_size(\%::);'
279172
$ ./perl -Ilib -MDevel::Size=total_size -le 'use POSIX; print total_size(\%::);'
532234

So a bit of an increase if you don't export any symbols, but a big decrease for the default setting. Coming soon to a perl 5.9.3 near you.

And the constants now inline properly:

$ ./perl -Ilib -MO=Concise -MPOSIX -le 'print SEEK_SET'
6  <@> leave[1 ref] vKP/REFC ->(end)
1     <0> enter ->2
2     <;> nextstate(main 428 -e:1) v ->3
5     <@> print vK ->6
3        <0> pushmark s ->4
4        <$> const(IV 0) s ->5
-e syntax OK

In all released perls they can't:

$ perl -MO=Concise -MPOSIX -le 'print SEEK_SET'
8  <@> leave[1 ref] vKP/REFC ->(end)
1     <0> enter ->2
2     <;> nextstate(main 117 -e:1) v ->3
7     <@> print vK ->8
3        <0> pushmark s ->4
6        <1> entersub[t1] lKS/TARG,1 ->7
-           <1> ex-list lK ->6
4              <0> pushmark s ->5
-              <1> ex-rv2cv sK/129 ->-
5                 <$> gv(*SEEK_SET) s ->6
-e syntax OK