-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UPDATE] support negative indices for iget and iset.
- Loading branch information
Showing
5 changed files
with
77 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
'use strict'; | ||
|
||
// MODULES // | ||
|
||
var matrix = require( './../lib' ); | ||
|
||
|
||
// VARIABLES // | ||
|
||
var start, | ||
stop, | ||
nRows, | ||
nCols, | ||
res, | ||
len, | ||
m, | ||
v, | ||
i, j; | ||
|
||
|
||
// -------------------------------------- | ||
// WARM-UP | ||
|
||
len = 1e6; | ||
for ( i = 0; i < len; i++ ) { | ||
i = i; | ||
} | ||
|
||
|
||
// -------------------------------------- | ||
// BENCHMARK | ||
|
||
len = 1e6; | ||
nRows = 128; | ||
nCols = 128; | ||
|
||
res = new Array( 1 ); | ||
|
||
m = matrix( [nRows,nCols] ); | ||
j = 64*m.strides[0] + 1*m.strides[1]; | ||
|
||
start = process.hrtime(); | ||
for ( i = 0; i < len; i++ ) { | ||
v = m.iget( j ); | ||
} | ||
stop = process.hrtime( start ); | ||
|
||
res[ 0 ] = stop[ 0 ] + stop[ 1 ]*1e-9; | ||
|
||
|
||
// -------------------------------------- | ||
// RESULTS | ||
|
||
console.log( 'iget:\t%d ops/sec', Math.floor( len/res[ 0 ] ) ); | ||
console.log( '\n' ); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters