Skip to content

change old (<=0.10) node detection #25

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

Closed
wants to merge 1 commit into from

Conversation

fanatid
Copy link
Contributor

@fanatid fanatid commented Feb 24, 2016

Not sure that you will agree with export changes, but I ready remove this.

@dcousens
Copy link
Member

LGTM.
ping @calvinmetcalf was there any reason not to do it like this?

@calvinmetcalf
Copy link
Contributor

the current version will always work while the updated version will probably work, I can't see this as being much of a speed up considering the a single round of pbkdf2 is by definition a small fraction of the total run time of the eventual computation

@fanatid fanatid force-pushed the feature/is-old-node branch from 7b6f73c to e191f7e Compare February 24, 2016 15:35
@fanatid
Copy link
Contributor Author

fanatid commented Feb 24, 2016

Updated.
@calvinmetcalf I returned check for digest support through pbkdf2Sync, but remove isNode10 call from every call pbkdf2Sync/pbkdf2. It should give little speed-up.

@calvinmetcalf
Copy link
Contributor

so yes it will add a speed up to the first call, but a slowdown for every program that requires this module, previously the has was calculated only the first time pbkdf2 was called and then never calculated again. I'm not convinced that removing that one function call if statement is much of a speedup in the first place...

@fanatid
Copy link
Contributor Author

fanatid commented Feb 24, 2016

Agree isNode10 has cache and I sure that function call will be very fast, but main idea now that we don't need wrapper for node > 0.10

@calvinmetcalf
Copy link
Contributor

ok but your way of testing slows down the start up of every program that requires this module...

@fanatid
Copy link
Contributor Author

fanatid commented Feb 24, 2016

I don't understand...
IIFE will be called once, require caches this.

$ cat a.js 
require('./x')
require('./b')
$ cat b.js 
require('./x')
$ cat x.js 
var f = (function () {
  console.log('h1')
  return true
})()

module.exports = f ? 1 : 0
$ node a.js 
h1

@calvinmetcalf
Copy link
Contributor

yes but it will be called even if somebody never uses pbkdf2 instead of the
first time pbkdf2 is called. Or put another way it will delay the startup
of the program instead of the start of the first call to this function.

On Wed, Feb 24, 2016 at 12:22 PM Kirill Fomichev notifications@github.com
wrote:

I don't understand...
IIFE will be called once, require caches this.

$ cat a.js
require('./x')
require('./b')
$ cat b.js
require('./x')
$ cat x.js
var f = (function () {
console.log('h1')
return true
})()

module.exports = f ? 1 : 0
$ node a.js
h1


Reply to this email directly or view it on GitHub
#25 (comment)
.

@fanatid
Copy link
Contributor Author

fanatid commented Feb 24, 2016

Oh, I see it now. Thanks @calvinmetcalf for explanation!

I see two options:

  1. if we want remove wrapper for node > 0.10, we should check through process.version
  2. if we want use check through crypto.pbkdf2Sync, we should use wrapper and close this PR

@calvinmetcalf
Copy link
Contributor

yes you got it, I believe I originally used process.version, but when iojs happened the tests broke which is why I'm somewhat distrustful of the process.version testing

@calvinmetcalf
Copy link
Contributor

this was merged as part of #27

@fanatid fanatid deleted the feature/is-old-node branch March 8, 2016 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants