in reply to Re^7: bit by overhead
in thread bit by overhead

Or, if you do use all the value for each ticker each time

...you could collapse the remaining array too.

Update: It's slower though??

my %cache3; sub to_cache3 { my( $ticker, $data ) = @_; $cache3{$ticker} = pack "(A10FFFFL)*", map @$_, @$data; } sub from_cache3 { my $ticker = shift; return [ map [ unpack "A10FFFFL", $_ ], $cache3{$ticker} =~ /.{46} +/sg ]; }
Rate mod2 orig mod1 mod2 9.43/s -- -1% -72% orig 9.52/s 1% -- -72% mod1 33.7/s 257% 253% --

Replies are listed 'Best First'.
Re^9: bit by overhead
by BrowserUk (Patriarch) on Jan 06, 2011 at 22:12 UTC

    I tried almost the same thing with the same result:

    my %cache3; sub to_cache3 { my( $ticker, $data ) = @_; $cache3{$ticker} = pack "(A10FFFFL)*", map @$_, @$data; } sub from_cache3 { my $ticker = shift; return [ map[ unpack("A10FFFFL", $_) ], unpack '(A[A10FFFFL])*', $cache3{$ticker} ]; } C:\test>880868-2 Rate mod2 orig mod1 mod2 18.9/s -- -3% -76% orig 19.4/s 3% -- -75% mod1 78.5/s 316% 304% --

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.