new Function in Web Workers significantly slower

Confirmed Issue #9779930 • Assigned to Louis L.

Details

Author
Micha R.
Created
Nov 13, 2016
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
38.14393
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

If new Function constructor is used to create a function from source in a web worker than this function performs significantly slower than if “static” function is used instead. I did not manage to profile the case since Edge Dev Tools provide no profiling for Web Workers. However, I have a Benchmarks Page that shows the issue.

If parallel-dynamic (or threadsjs) together with Mandelbrot is selected (unselect the other test cases like Knight-Tours and Montecarlo) the benchmark even performs slower (800s) than if the computation is performed synchronously (512s). The implementation serializes the Function used to compute a single line in the Mandelbrot and reconstructs it using new Function in the Web Worker.

If instead parallel-transpiled (or parallel.js) is selected, the test outperforms (132) the synchronous implementation by a multitude (as it should be). The code used for computing the Mandelbrot line is exactly the same. The only difference is that the function is defined statically in the web worker js file.

I could not reproduce the issue if the Function constructor is used inside the ui-thread. So I assume it is related to web workers in combination with dynamic function constructs.

Attachments

0 attachments

    Comments and activity

    • Source Code of Project is available:

      parallel.es
      Benchmark Page / Examples

    • Microsoft Edge Team

      Changed Assigned To to “Ibrahim O.”

      Changed Assigned To to “Rico M.”

      Changed Assigned To from “Rico M.” to “Todd R.”

      Changed Status to “Confirmed”

      Changed Assigned To from “Todd R.” to “Louis L.”

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

    Sign in