in reply to How do I unpack Perl floats in C

Are you sure the unpack is the bottleneck?

Running the following snippet on my pretty average hardware does around 800_000 unpacks per second.

my $buf = pack "FFFFL", (0.1) x 4, 999; for (1..1000_000) { my @row = unpack "FFFFL", $buf; } __END__ $ time ./836298.pl real 0m1.286s user 0m1.280s sys 0m0.004s

I'd wager an XS routine doing the same wouldn't really be a lot faster...

Replies are listed 'Best First'.
Re^2: How do I unpack Perl floats in C
by Anonymous Monk on Apr 22, 2010 at 18:58 UTC
    According to the profiler that I used, out of a 2 minuite execution time, bout 30 seconds is spent in calls to unpack.
      So 20,000,000 million records? What do you do with the results of the unpack? You'll need to reimplement more than just a single opcode to get a benefit.