-
Notifications
You must be signed in to change notification settings - Fork 495
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(@embark/utils): use a 'ws' websocket client in pingEndpoint #1196
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 move this require statement out of this function and put it at the top of the file?
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.
How about instead a quick follow-up PR (I'll do it) that lifts all of the
require
s inutils.js
to top-level imports?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.
Don't do it!!
There are some requires that are super heavy that are required just by one or two methods that are then used by some processes and it slows those processes a lot.
The real fix would be to split the utils file in multiple files and then we can put the requires at the top, but they would be used by all or most of the functions.
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.
Thanks for the heads-up! Another options would be to make light static
import
s top-level; for the ones we know to be heavy we could use inline dynamicimport()
(our babel config already supports it). Dynamic import is async (returns a promise) whereasrequire()
is synchronous, so might require some refactoring.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.
@jrainville do we know which (or at least some) that fall under this category? I'm actually surprised that this is a problem for process performance..
Yea I don't really think this can be considered a fix. I'd rather figure out how loading (bigger) node modules can slow down processes.
Maybe we can get some benchmarks for some reproducible scenarios.
Happy to explore the dynamic import route at some point. But "checking" every imported module whether or not it's too "heavy" doesn't really sound like the right move to me.
I hope we can take some time in the near future getting to the bottom of this and figuring out how what affects what.
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.
Anything that requires web is super heavy.
An example of a process that could be slowed in the pipeline, it might need to use a small utils functions, but then it would need to require every package, include web3.