Skip to content

Create _benchmarks/point-object-vs-x-y-array.md #330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions _benchmarks/point-object-vs-x-y-array.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: Point object vs X/Y -array
setup: |
var pt = function(x,y){
this.X = x;
this.Y = y;
}
var poly = new Array(1000);
var pt2;

var poly_X = new Float64Array(1000);
var poly_Y = new Float64Array(1000);
tests:
-
name: Point object
code: |
for(var i = 0; i < 1000; i++)
{
pt2 = new pt(Math.random,Math.random);
poly[i] = pt2;
}
-
name: X/Y -array
code: |
for(var i = 0; i < 1000; i++)
{
poly_X[i] = Math.random;
poly_Y[i] = Math.random;
}
---
Point-object vs. X/Y -typed arrays