ssbc / ssb-meta-feeds

10 stars 0 forks source link

add ability to skipMainFeed connection #121

Closed mixmix closed 1 year ago

mixmix commented 1 year ago

Background

ssb-tribes2 test suite was taking 3min 40s to run on my desktop. I did a little analysis and found that there was sometimes significant slow-downs calling ssb.metafeeds.findOrCreate , in particular the ssb.tribes.start() seems to take 3 seconds to complete (and it creates locks).

Improvement

I noticed that unless we were testing persistence, setting up the main feed (publishing the rootMetaFeedId, and setting the main feed up in a shard...) is slow, and not actually useful for most tests.

I experimented with extracting that step and making it possible to turn it off.

mixmix commented 1 year ago

Here it is in ssb-tribes2 : https://github.com/ssbc/ssb-tribes2/pull/63

staltz commented 1 year ago

Profiling shows that it takes about 500ms to announce the root on the main, but it takes 1600ms to create /root/v1/:shard/main.

staltz commented 1 year ago

I think all of these waits are coming from lodash.debounce which is sprinkled around in ssb-db2 and async-append-only-log. In some tests we have disabled those timers so that tests run quicker.

staltz commented 1 year ago

Can we close this PR? @mixmix