Skip to content
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

Optimizations for script.toAddress() #1296

Merged
merged 5 commits into from
Jul 9, 2015

Conversation

braydonf
Copy link
Contributor

@braydonf braydonf commented Jul 8, 2015

Several optimizations for script.toAddress() for around a 4x speed improvement.

@braydonf braydonf changed the title Use late definition to resolve circular dependency. Optimizations for script.toAddress() Jul 9, 2015
@@ -505,3 +504,5 @@ Address.prototype.inspect = function() {
};

module.exports = Address;

var Script = require('./script');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolves the circular dependency between address.js and script.js without needing to have several address.js require statements in functions in script.js that slowed each function down each time it was invoked. Using a late definition here is faster.

@maraoz
Copy link
Contributor

maraoz commented Jul 9, 2015

LGTM

@pnagurny
Copy link
Contributor

pnagurny commented Jul 9, 2015

LGTM

pnagurny added a commit that referenced this pull request Jul 9, 2015
Optimizations for `script.toAddress()`
@pnagurny pnagurny merged commit 1a809cb into bitpay:master Jul 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants