Skip to content

Commit

Permalink
add font setter benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
chearon committed Dec 27, 2024
1 parent 8346512 commit 322b129
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions benchmarks/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ function done (benchmark, times, start, isAsync) {

// node-canvas

bm('font setter', function () {
ctx.font = '12px arial'
ctx.font = '400 6px Helvetica'
ctx.font = String(Math.random()).repeat(100)
ctx.font = 'normal normal normal bold 12cm Raleway'
ctx.font = 'ultra-condensed italic 9mm Dingbats, "Times New Roman", "Apple Color Emoji", "Comic Sans"'
ctx.font = 'small-caps oblique expanded 44px/44px "The Quick Brown", "Fox Jumped", "Over", "The", "Lazy Dog"'
})

bm('save/restore', function () {
for (let i = 0; i < 1000; i++) {
const max = i & 15
Expand Down

0 comments on commit 322b129

Please sign in to comment.