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

Feat/pull mplex #3

Closed
wants to merge 42 commits into from
Closed

Feat/pull mplex #3

wants to merge 42 commits into from

Conversation

dryajov
Copy link
Member

@dryajov dryajov commented May 10, 2018

UPDATE: This is now ready for review.

TODO:

  • Performance
    • pool channel objects (should come next, but not critical for first release)

Bellow are the accompanying PRs:


The current implementation takes around ~15mins more running the mega stress tests defined in interface-stream-muxer.

Here is the outline:

New:

screen shot 2018-04-21 at 11 08 05 am

Old:

screen shot 2018-04-21 at 6 32 53 pm


The issue is here - https://github.com/libp2p/pull-mplex/blob/850bbc52c33038f2cdeff40e83afbcf4823b3895/src/coder.js#L85...L89. I need to rework this part to use a preallocated buffer, instead of allocating it every time.


Perf:

I was able to shave off ~15 mins of the new implementations running the mega stress tests, the perf is now about the same (or a little better ;) ) than the stream based implementation.

screen shot 2018-04-27 at 7 13 30 pm

Archive.zip

The attached zip contains a heap snapshot and a perf log taken with node --prof --nologfile_per_isolate --logfile=xxxxxx.log --log-timer-events /private/var/folders/_r/6c6jf6m10kb3v9kt45qspw4w0000gn/T/v8profilerProxy.js. The one thing that still irks me a bit is the excessive (compared to the prev implementation) GC time. I think we can improve that a lot by pooling the Channel objects and reusing them, rather than creating new ones every time.

Here is a screenshot from the perf log graph - GC is seems to take ~13% of the total time. (These graphs where generated using the attached logs, and webstorm perf and heap analyzers).

screen shot 2018-04-27 at 7 28 07 pm

screen shot 2018-04-27 at 7 27 54 pm

@ghost ghost assigned dryajov May 10, 2018
@ghost ghost added the status/in-progress In progress label May 10, 2018
@dryajov dryajov requested review from pgte, jacobheun and daviddias May 10, 2018 19:31
@dryajov
Copy link
Member Author

dryajov commented May 10, 2018

Use this instead of #2 and #3. Had a few issues with this PRs getting mangled, hopefully this one will stay.

@dryajov dryajov closed this May 10, 2018
@dryajov dryajov force-pushed the feat/pull-mplex-3 branch from cd93515 to ea9b678 Compare May 10, 2018 19:53
@ghost ghost removed the status/in-progress In progress label May 10, 2018
This was referenced May 10, 2018
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.

1 participant