Test name | Executions per second |
---|---|
Canvas | 522894.0 Ops/sec |
Offscreen | 534176.3 Ops/sec |
Canvas font | 1818508.6 Ops/sec |
Offscreen font | 5847189.5 Ops/sec |
Canvas textBaseline | 5072035.5 Ops/sec |
Offscreen textBaseline | 4831063.5 Ops/sec |
Canvas textAlign | 5104876.0 Ops/sec |
Offscreen textAlign | 4724849.5 Ops/sec |
var canvas = document.createElement('canvas');
var context = canvas.getContext('2d');
var offscreenCanvas = new OffscreenCanvas(0, 0);
var offscreenContext = offscreenCanvas.getContext('2d');
context.measureText('M');
offscreenContext.measureText('M');
context.font = 'bold 48px serif';
offscreenContext.font = 'bold 48px serif';
context.textBaseline = "hanging";
offscreenContext.textBaseline = "hanging";
context.textAlign = "center";
offscreenContext.textAlign = "center";