Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

perf: faster startup time #1542

Merged
merged 6 commits into from
Sep 12, 2018
Merged

Conversation

alanshaw
Copy link
Member

@alanshaw alanshaw commented Sep 5, 2018

I noticed that libp2p takes over 200ms to require.

When using the CLI with no daemon we never start the IPFS node so libp2p is required but unused.

This PR lazily requires libp2p when start is called, which means that if the node is never started, you do not suffer the 200ms it takes to require the library.

Before (jsipfs add file.txt with daemon off):

screen shot 2018-09-05 at 11 05 47

After:

screen shot 2018-09-05 at 11 05 49

@ghost ghost assigned alanshaw Sep 5, 2018
@ghost ghost added the status/in-progress In progress label Sep 5, 2018
@alanshaw alanshaw force-pushed the perf/faster-startup-time-20180905 branch 7 times, most recently from 1259868 to 41cba88 Compare September 11, 2018 11:29
@alanshaw alanshaw force-pushed the perf/faster-startup-time-20180905 branch from e0e14de to 44b07da Compare September 12, 2018 09:45
Calls back when async func returns true.

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
I noticed that libp2p takes over 200ms to require. When using the CLI with no daemon we never start the IPFS node so libp2p is required but unused. This PR lazily requires libp2p when start is called, which means that if the node is never started, you do not suffer the 200ms it takes to require the library.

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants