On Sun, Dec 17, 2000 at 04:29:24PM +0000, Nicholas Clark wrote: > Why do all the XS constant() routines (that I've looked at) have a second > unused integer argument after the name argument? > I assume that they return double because perl did all arithmetic (except > logical operations such as |) as doubles I think pretty much all the Perl XS extensions have started their life as h2xs outputs, even if they have been mucked around by hand quite extensively since then -- and h2xs still has these lines: print $fh <<"END"; static double constant(char *name, int len, int arg) { errno = 0; Not even NV, "double". Sigh. > Following patch speeds up Fcntl's constant routine (ever so slightly, but > now that == likes IVs there will be knock on speedups) > > Before: > > ./perl -Ilib -MBenchmark -MFcntl -e 'timethese (1000000, {"Get"=> q($foo = O_NDELAY; undef \&Fcntl::O_NDELAY)})' > Benchmark: timing 1000000 iterations of Get... > Get: 6 wallclock secs ( 5.53 usr + 0.00 sys = 5.53 CPU) @ 180831.83/s (n=1000000) > > ./perl -Ilib -MBenchmark -MFcntl -e 'timethese (1000000, {"Get"=> q($foo = O_NDELAY; undef \&Fcntl::O_NDELAY)})' > Benchmark: timing 1000000 iterations of Get... > Get: 3 wallclock secs ( 4.27 usr + 0.00 sys = 4.27 CPU) @ 234192.04/s (n=1000000) Thanks, I need all the possible speedups I can find to pay for my regex polymorphism patch :-) -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack CohenThread Previous | Thread Next