More info: this performance issue happens only in Chrome, but not in
Firefox with Gears. Using the latest Chrome (3.0.195.xxx) and the
latest FF (3.5.3) on Windows 7. In FF 1Mb+ files are read in seconds,
while Chrome hangs for a minute or so.

On Oct 9, 4:30 pm, MG <[email protected]> wrote:
> Hello!
>
> I'm using blob api to read a local file into a string:
> desktop.openFiles(), then blob.getBytes(), then convert bytes to chars
> and append to a string. As blob.getBytes() can read only 1024
> characters max (throws an exception saying that 1024 is max), I'm
> reading it in steps of 1024.
>
> I experience substantial degradation of performance as I move further
> and further down the file, to the degree that Chrome tells the that
> the plugin is unresponsive. I'm not doing anything else, just reading
> bytes (for testing purposes):
>
>                 var bytes = [];
>
>                 var nBytes = blob.length;
>                 var nStep = 0;
>                 for (nStep = 0; nStep < nBytes; nStep += 1024) {
>                         var nLen = nBytes - nStep;
>                         if( nLen > 1024 ) nLen = 1024;
>                         // bytes = bytes.concat(blob.getBytes(nStep, nLen));
>                         bytes = blob.getBytes(nStep, nLen); // this line 
> takes longer and
> longer, seconds, tens of seconds, etc.
>                 }
>
>                 // convert bytes to a string
>
> The file I'm reading is not that long - only about 1.5Mb. Is this a
> bug in Gears, or am I doing it wrong? Should I slice the blob before
> reading it? It should be that slow - I'm working with 2Mb strings in
> JavaScript w/o a lot of delays (in Chrome/FF/Safari), and blobs, as
> binary objects, should be even faster...
>
> Thanks,
> MG

Reply via email to