Closed mauriciopoppe closed 9 months ago
Design doc at ./design/web-workers.md
┌─────────┬───────────────────────────────┬─────────┬───────────────────┬──────────┬─────────┐ │ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │ ├─────────┼───────────────────────────────┼─────────┼───────────────────┼──────────┼─────────┤ │ 0 │ 'compile and eval 1800' │ '567' │ 1761171.361090432 │ '±4.58%' │ 284 │ │ 1 │ 'async compile and eval 1800' │ '1,430' │ 699015.7267567831 │ '±3.78%' │ 716 │ └─────────┴───────────────────────────────┴─────────┴───────────────────┴──────────┴─────────┘
The eval pipeline is now parallelized into groups and sent to the web worker pool.
Sync render
functionPlot({ target: '#playground', width: window.innerWidth, height: window.innerHeight, data: [ { fn: 'x^2', nSamples: window.innerWidth*5, sampler: 'interval' }, { fn: 'sin(x)', nSamples: window.innerWidth*5, sampler: 'interval' }, { fn: '1/x', nSamples: window.innerWidth*5, sampler: 'interval' }, ] })
Async render
functionPlot.withWebWorkers(8) functionPlot({ target: '#playground', width: window.innerWidth, height: window.innerHeight, data: [ { fn: 'x^2', nSamples: window.innerWidth*5, sampler: 'asyncInterval' }, { fn: 'sin(x)', nSamples: window.innerWidth*5, sampler: 'asyncInterval' }, { fn: '1/x', nSamples: window.innerWidth*5, sampler: 'asyncInterval' }, ] })
Design doc at ./design/web-workers.md
Performance numbers
The eval pipeline is now parallelized into groups and sent to the web worker pool.
Results
Sync render
Async render