-
Notifications
You must be signed in to change notification settings - Fork 7
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
use bipf 1.6.0 seekKeyCached #209
Conversation
indexName: | ||
'value_content_vote_link_%wOtfXXopI3mTHL6F7Y3XXNtpxws9mQdaEocNJuKtAZo=.sha256', | ||
indexType: 'value_content_vote_link', | ||
indexName: 'value_content_vote_link', |
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.
Unrelated to this PR, I just stumbled upon this and decided to fix it so that these two fields would match what we would get from operators.js
Yeah this is great. Can you create a db2 branch that builds on top of this? That makes it easier for me to test. |
Working on it! |
@arj03 One problem is that we have to have global and unique buffers for B_VALUE and others, otherwise we can end up having two B_VALUEs which are in different memory addresses, and the WeakMap idea won't work on them. E.g. const a = Buffer.from('value')
const b = Buffer.from('value')
a === b // false
const weakMap = new WeakMap()
weakMap.set(a, 3)
weakMap.has(b) // false |
Ugh, would it be possible to pass in value as a string. I think they match the same address or am I confusing javascript with .net ;-)? |
Yeah, that's what I'm thinking about. |
My benchmark script, it's a bit hacky but gets the job done :) const SecretStack = require('secret-stack')
const caps = require('ssb-caps')
const path = require('path')
const ssbKeys = require('ssb-keys')
const { where, and, type, isRoot, hasRoot, author, paginate, descending,
toPullStream, toCallback } = require('../operators')
const bipf = require('bipf')
const pull = require('pull-stream')
const dir = './perf-testing/ssb'
const keys = ssbKeys.loadOrCreateSync(path.join('/home/arj/.ssb', 'secret'))
const ssb = SecretStack({ appKey: caps.shs })
.use(require('../'))
.use(require('../compat/ebt')) // ebt db helpers
.use(require('../full-mentions')) // include index
.call(null, {
keys,
path: dir,
db2: {
startDecryptBox1: "2022-03-25",
}
})
console.log('Doing the query')
console.time('query')
ssb.db.getJITDB().all(
author('@QlCTpvY7p9ty2yOFrv1WU1AE88aoQc4Y7wYal7PFc+w=.ed25519'),
0, false, false, null, (err, results) => {
console.timeEnd('query')
console.log(results.length)
}
) and then I delete all indexes to test both level + jitdb and only:
to test only jitdb :) And ./perf-testing/ssb/log.bipf is just a copy from ~/.ssb |
Benchmark results
|
Parking this as draft for now because this PR can only be merged if it necessarily makes performance better. |
Context: #208
Uses BIPF 1.6.0's
seekKeyCached
API instead of passing pValue around.@arj03 How did you run those benchmarks in your PR? Could you try running them with this code? I know you did a good job in #208, but I think
seekKeyCached
is going to help us withpValueContent
and potentially others.