Closed Bug 1408314 Opened 7 years ago Closed 7 years ago

FileReader readAsArrayBuffer bad performance drop

Categories

(Core :: DOM: Core & HTML, defect, P3)

55 Branch
defect

Tracking

()

RESOLVED DUPLICATE of bug 1397645

People

(Reporter: sharun.msgs, Unassigned, NeedInfo)

Details

(Keywords: perf, regression)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

Steps to reproduce:

1. Open a large file(>500MB) with the File Selector or use fsutil to create a dummy file. 
2. Try reading a few bytes from somewhere towards the end of the file. The deeper the read the longer it takes. 

The code I used below reads 8 bytes from 1000000000. Few months back this would run under 10ms now it takes 15 seconds.

<html>
<script>
function init(){
	var readslice=function(){
	    var reader = new FileReader();
            reader.onload = function(e) {
                console.timeEnd("readAsArrayBuffer");
                console.log(new Uint8Array(e.target.result));
            };
            var fileInput = document.querySelector("#myfile");
	    var file = fileInput.files[0];
	    console.time("slice");
	    var b = 1000000000;
	    var e = b + 8;
            console.time("readAsArrayBuffer");
	    reader.readAsArrayBuffer(file.slice(b, e));
    }
    document.querySelector("#myfile").onchange=readslice;
}
</script>
<body onload=init();>
<input id="myfile" type="file">
</body>
</html>



Actual results:

I ran mozregression (first time I am using it so still figuring it out) 
and it found

commit to Bug 1359172 - RemoteInputStream must create a correct inputStream when used and sliced in a separate process, r=smaug from April-27-2017
build_date: 2017-04-25 10:46:37.141000
build_type: inbound
build_url: https://queue.taskcluster.net/v1/task/L2ORTMtrTj-bCKaHopa8BA/runs/0/artifacts/public%2Fbuild%2Ffirefox-55.0a1.en-US.win64.zip
changeset: 5633dacc482dc373aa7ba40f4bddce4315296465
pushlog_url: https://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=5633dacc482dc373aa7ba40f4bddce4315296465&tochange=1426ecc8209defd3fc9ac76170a7b9e6b416ff90
repo_name: mozilla-inbound
repo_url: https://hg.mozilla.org/integration/mozilla-inbound
task_id: L2ORTMtrTj-bCKaHopa8BA


I have been noticing this performance drop showing up now and then for a couple months now. Just hadn't figured it was coming from readAsArrayBuffer.

Testing on small files or reading bytes from the beginning of the file won't pick up this issue. 
 


Expected results:

Read should be happening under 10ms but is taking 15s.
Has Regression Range: --- → yes
Component: Untriaged → DOM
Keywords: perf, regression
Product: Firefox → Core
Flags: needinfo?(amarchesini)
(In reply to sharun.msgs from comment #0)
> User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
> (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

Is this nightly? or 57? I guess this is already fixed in 57.
Flags: needinfo?(amarchesini) → needinfo?(sharun.msgs)
Priority: -- → P3
It definitely looks a dup of bug 1397645
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Just confirmed works on 57. Thanks!
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.