Darn! It turns out that I was naive and jumped to the first conclusion at hand. The $Application object does admit 8 bit chars, it was character 0x00 the one to blame! After running tye's code and looking carefully at the output I found out that $Application returns strings that are truncated at the first appearance of character 0x00. This char seems to be a string terminator for whatever language the object was coded with (a vague memory of having learned this at college comes afloat).

After running a modified version of tye's code (below) I was able to further push the thawing time for my 17K elements hash to 0.15s. This and the time it takes to move memory from $Application gives me a decent 0.26s total, which is 10x better than going to the database and well enough for our expected site traffic.

One big and a respectful bow towards tye!

{ my( $quote7, $quote8, $zero, $one, %quote, %unquote ); BEGIN { $quote7= pack "C", 0x7e; # Any 7-bit char. $quote8= pack "C", 0x7f; # Any _other_ 7-bit char. $zero = pack "C", 0x00; $one = pack "C", 0x01; @quote{ $quote7, $quote8, $zero }= ( $quote7.$quote7, $quote7.$quote8, $quote7.$one ); %unquote= reverse %quote; } sub strip8 { my( $bin )= @_; $bin =~ s#([$quote7$quote8$zero])#$quote{$1}#go; return $bin; } sub restore8 { my( $str )= @_; $str =~ s#([$quote7$quote8].)#$unquote{$1}#gos; return $str; } }

In reply to Re: ASP and Storable woes by gregorovius
in thread ASP and Storable woes by gregorovius

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.