arj03 / ssb-browser-core

ssb-server in a browser
Other
50 stars 8 forks source link

Add channels index #23

Closed KyleMaas closed 3 years ago

KyleMaas commented 3 years ago

Tried adding a channel index. This actually seems to work pretty well.

arj03 commented 3 years ago

Yes, nice. Need to test what this does for onboarding performance.

KyleMaas commented 3 years ago

Without channel index:

full feeds: 513.962158203125 ms
partial feeds: 4963.927001953125 ms

With index:

full feeds: 548.82275390625 ms
partial feeds: 4259.909912109375 ms
KyleMaas commented 3 years ago

Pulling channel list on Channels using Overall Popular (which queries all posts with a channel) vs. All Alphabetically (which uses the index):

channel list: 35.903076171875 ms
channel list: 0.638916015625 ms

This test was done with following both of your accounts so it would have more channel data to work with.

KyleMaas commented 3 years ago

See https://github.com/arj03/ssb-browser-demo/pull/197 for uses

arj03 commented 3 years ago

Yeah I think we can do this. We need a way to disable the index because not all browser apps want to use this index. I tested indexing and its 850 ms outside the browser so that seems ok. I have a few comments on the index that would be good to get in before we merge this.

KyleMaas commented 3 years ago

Have not tested that version yet, but that should include all the changes.

KyleMaas commented 3 years ago

Tried it, and it works pretty well. Want to make one more change so that ##channel is counted as just channel. If we're going to keep counts, it makes a difference.

arj03 commented 3 years ago

Yes, no rush with this. Lets get this index right before merging :)

KyleMaas commented 3 years ago

Fixed stray leading '#'s, removed compatibility code. Checked it, and "patchbook" now shows a count of 3 where before you had to add "patchbook" and "#patchbook" together to get that.

KyleMaas commented 3 years ago

I'm pretty happy with the way this works at this point. Stripping out leading '#'s means I can remove some of the duplicate code from the channel-index branch of ssb-browser-demo.

arj03 commented 3 years ago

Tested this. Did a full sync of my browser profile and the sync time did not noticeable change. Are the changes to ssb-browser-demo in the PR ready? It's no rush, just don't want to merge this before :)

KyleMaas commented 3 years ago

Yes. I left it in Draft status until this was ready, but it worked quite well when I last tested it.

arj03 commented 3 years ago

Sweet. Will release this as 8.1.0 in a minute or two :)

KyleMaas commented 3 years ago

Awesome. You need me to update package.json and npm-shrinkwrap.json on the ssb-browser-demo branch to fix the merge conflicts, or do you want to do that?

arj03 commented 3 years ago

Can you do that @KyleMaas ?