new Blob() is much slower and eats 50 times more memory than it should

Fixed, not yet flighted Issue #7115840

Details

Author
Tamás L.
Created
Apr 5, 2016
Privacy
This issue is public.
Found in
  • Internet Explorer
Found in build #
11
Reports
Reported by 2 people

Sign in to watch or report this issue.

Steps to reproduce

In IE11, creating a 20MB blob from 640 individual 32kB Uint8Arrays takes several seconds and consumes 1 GB of memory. Run the following function to reproduce. The interesting thing is that the example is sensitive to the exact size of the final blob, and the size of the chunks. With different setup (for example 5MB total, 4-8kB chunk size) memory consumption just bounces, never reaches such high levels. I assumed it started burning the blob chunks to disk.

function allocate() {
  var TOTAL_SIZE = 20 * 1024 * 1024;
  var CHUNK_SIZE = 32 * 1024;
  var CHUNK_COUNT = TOTAL_SIZE / CHUNK_SIZE;
  console.log("TOTAL_SIZE: " + TOTAL_SIZE);
  console.log("CHUNK_SIZE: " + CHUNK_SIZE);
  console.log("CHUNK_COUNT: " + CHUNK_COUNT);
  var time, chunks = [];
  console.log("Building chunks start");
  time = Date.now();
  for (var i = 0; i < CHUNK_COUNT; i++) {
    chunks.push(new Uint8Array(TOTAL_SIZE / CHUNK_COUNT));
  }
  console.log("Building chunks end: " + (Date.now() - time) + " ms");
  console.log("Blob constructor start");
  time = Date.now();
  new Blob(chunks);
  console.log("Blob constructor end: " + (Date.now() - time) + " ms");
}

Running this on my machine produces the following log:

TOTAL_SIZE: 20971520
CHUNK_SIZE: 32768
CHUNK_COUNT: 640
Building chunks start
Building chunks end: 7 ms
Blob constructor start
Blob constructor end: 5559 ms

See memory usage graph attached.
System:
Windows 10 Enterprise 64-bit (10.0, Build 10586)
Internet Explorer 11
Version: 11.162.10586.0
Update Versions: 11.0.29

Attachments

1 attachment

Comments and activity

  • Microsoft Edge Team

    Changed Assigned To to “Rico M.”

    Changed Assigned To from “Rico M.” to “Brandon H.”

    Changed Status to “Confirmed”

    Changed Title from “new Blob() is unbearably slow and eats 50 times more memory than it should” to “new Blob() is much slower and eats 50 times more memory than it should”

    Changed Status from “Confirmed”

    Changed Assigned To to “Rico M.”

    Changed Assigned To from “Rico M.” to “Thomas M.”

    Changed Status to “Confirmed”

    Changed Status from “Confirmed” to “Fixed, not yet flighted”

  • Thanks for the feedback. Based on comments here that I see this has been fixed. Please feel free to reactivate this item of feedback if you are still seeing the problem in later builds.

    All the best,
    The MS Edge Team

You need to sign in to your Microsoft account to add a comment.

Sign in