I had a bit of a twisted epiphany yesterday...  To reduce the size of  
my calculator's bookmarklet, I could compress it, then use javascript  
inside the data: URI to decompress it.  So I coded up an LZW  
compressor and a javascript decompressor and tried them out.

The bookmarklet was reduced to 34% of it's original size, which was a  
real win!  In my desktop Safari web browser it worked like a charm.   
In the iPhone... not so much.  Turns out it runs afoul of the 5  
second scripting timeout.  I went through the javascript code and did  
a ton of optimizations, which sped up the code about 400%, but it's  
still timing out.  I even redid the algorithm to be faster but  
compress less well. (Result was ~65% original size instead of 34%)   
Still no go.

When all is said and done, I can only seem to decompress about 14KB  
of compressed data (about 20K uncompressed) before the iPhone will  
time it out.

Sooooooo... I took a comparative look at the speed the code is  
running, between my desktop Safari (on a 2.3GHz intel) and the iPhone  
(667MHz ARM11).  On the desktop I could decode 10000 bytes of  
compressed data in 39 milliseconds.  On the iPhone, the same  
decompress with the same code took 3492 milliseconds.

Normalizing that data for processor speed (flawed, using MHz, but I  
have no other comparative metrics), that's still over 1000x faster on  
the desktop, per MHz.  Three orders of magnitude.

...

Hmm.  I sense room for improvement.


     - Revar


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to