-
-
Notifications
You must be signed in to change notification settings - Fork 595
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
refactor: update blas/ext/base/grev
to follow current project conventions
#4659
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -21,11 +21,13 @@ | |||||
// MODULES // | ||||||
|
||||||
var bench = require( '@stdlib/bench' ); | ||||||
var randu = require( '@stdlib/random/base/randu' ); | ||||||
var uniform = require( '@stdlib/random/base/uniform' ).factory; | ||||||
var Float64Array = require( '@stdlib/array/float64' ); | ||||||
var gfillBy = require( '@stdlib/blas/ext/base/gfill-by' ); | ||||||
var isnan = require( '@stdlib/math/base/assert/is-nan' ); | ||||||
var pow = require( '@stdlib/math/base/special/pow' ); | ||||||
var pkg = require( './../package.json' ).name; | ||||||
var grev = require( './../lib/main.js' ).ndarray; | ||||||
var grev = require( './../lib/ndarray.js' ); | ||||||
|
||||||
|
||||||
// FUNCTIONS // | ||||||
|
@@ -38,13 +40,7 @@ var grev = require( './../lib/main.js' ).ndarray; | |||||
* @returns {Function} benchmark function | ||||||
*/ | ||||||
function createBenchmark( len ) { | ||||||
var x; | ||||||
var i; | ||||||
|
||||||
x = []; | ||||||
for ( i = 0; i < len; i++ ) { | ||||||
x.push( ( randu()*20.0 ) - 10.0 ); | ||||||
} | ||||||
var x = gfillBy( len, new Float64Array( len ), 1, uniform( -100, 100 ) ); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Planeshifter This wasn't the correct change. If we wanted generic arrays, then we should have used There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's problematic, especially for large arrays, as it can tank performance, thus throwing off benchmark results. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @headlessNode Would you mind submitting a follow-up PR addressing this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would also be a good lint rule. Namely, we should disallow There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kgryte I actually did use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @headlessNode One step ahead of me! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I should have looked at the final code, rather than just relying on the e-mail thread of discussions. |
||||||
return benchmark; | ||||||
|
||||||
function benchmark( b ) { | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please change this back to a generic array instead of
Float64Array
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment.