Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: ASP and Storable woes

by gregorovius (Friar)
on Sep 29, 2000 at 12:25 UTC ( [id://34569]=note: print w/replies, xml ) Need Help??


in reply to ASP and Storable woes

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; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://34569]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-16 13:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found