Skip to content

Instantly share code, notes, and snippets.

@tj
Created November 5, 2010 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tj/664922 to your computer and use it in GitHub Desktop.
Save tj/664922 to your computer and use it in GitHub Desktop.
10000 times
- lineTo() 0.001s
- fillStyle= hex 0.005s
- fillStyle= rgba() 0.004s
- fillRect() 0.078s
- strokeRect() 0.702s
- linear gradients 1.397s
- toBuffer() 200x200 (50 times) 0.226s
- toBuffer().toString("base64") 200x200 (50 times) 0.216s
- toDataURL() 200x200 (50 times) 0.219s
node-o3-canvas
- o3 lineTo() 0.226s
- o3 fillStyle= hex 0.03s
- o3 fillStyle= rgba() 0.04s
- o3 fillRect() 1.102s
- o3 strokeRect() 5.111s
- pngBuffer() 200x200 (50 times) 0.844s
- pngBuffer().toBase64() 200x200 (50 times) 0.837s
@tj
Copy link
Author

tj commented Nov 5, 2010

chrome results:

test.html:35
10000 times
- lineTo() 0.002s
- fillStyle= hex 0.003s
- fillStyle= rgba() 0.003s
- fillRect() 0.03s
- strokeRect() 0.192s
- linear gradients 1.962s
- toDataURL() 200x200 (50 times) 0.21s

@tj
Copy link
Author

tj commented Nov 5, 2010

FF 3.6 results:

10000 times
- lineTo() 0.007s
- fillStyle= hex 0.03s
- fillStyle= rgba() 0.035s
- fillRect() 8.223s
- strokeRect() 10.673s
- linear gradients 12.453s
- toDataURL() 200x200 (50 times) 0.175s

@tj
Copy link
Author

tj commented Nov 5, 2010

Safari 5.0:

10000 times
 - lineTo() 0.011s
 - fillStyle= hex 0.031s
 - fillStyle= rgba() 0.045s
 - fillRect() 0.024s
 - strokeRect() 0.162s
 - linear gradients 1.284s
 - toDataURL() 200x200 (50 times) 0.169s

@piranna
Copy link

piranna commented Feb 16, 2015

Upgraded version of the benchmarks? I'm interested about how node-canvas compares to node-openvg-canvas... :-)

@zbjornson
Copy link

@piranna check out the build logs from what will be 1.2.9+. https://travis-ci.org/Automattic/node-canvas/jobs/79960720#L3254 It's a bit hard to compare because I changed how the benchmarks run. If you convert ops/sec to sec/10k ops they're roughly the same with a few exceptions (linear gradients, toBuffer, strokeRect, and fillRect due to a bug).

https://docs.google.com/spreadsheets/d/1XVqSPe2Lt91Z9MTQCvSlwGniu0v8z8jg7OAKW4GipMA/edit?usp=sharing column I

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment