cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Kotikov (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CB-12085) FileReader#readAsArrayBuffer reads whole file
Date Mon, 21 Nov 2016 12:10:58 GMT

     [ https://issues.apache.org/jira/browse/CB-12085?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Vladimir Kotikov updated CB-12085:
----------------------------------
    Assignee: Nikita Matrosov

> FileReader#readAsArrayBuffer reads whole file
> ---------------------------------------------
>
>                 Key: CB-12085
>                 URL: https://issues.apache.org/jira/browse/CB-12085
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin File
>    Affects Versions: 4.3.0
>         Environment: Android
>            Reporter: Damian Senn
>            Assignee: Nikita Matrosov
>            Priority: Critical
>              Labels: performance
>
> Reading a File with
> ```js
> let fr = new FileReader
> fr.onload = () => done(fs.result)
> fr.readAsArrayBuffer(blob)
> ```
> Is very slow, I'm assuming this is because it reads the whole file, then transfers this
via base64 to the JS world, where it is converted to an ArrayBuffer. My use-case involves
reading some media metadata in JS-World, this usually involves reading several bytes (maybe
around 100b to 1kb) of 2mb to 50mb files.
> I noticed this by profiling via Chrome-DevTools where the most time is being spent in
the `atob` function in `cordova/base64.toArrayBuffer`.
> So parsing some hundreds of bytes on a 3mb file may take around 3 to 4 seconds on my
Samsung Galaxy S4 and around 1 second on my Samsung Galaxy S6. (This is without trying to
read the actual metadata from the file).
> My guess is that this also has a very negative impact on memory usage and garbage collection.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message