Skip to content
This repository has been archived by the owner on Sep 30, 2023. It is now read-only.

Commit

Permalink
Merge pull request #282 from orbitdb/feat/load-opt-fix-benchmarks
Browse files Browse the repository at this point in the history
Fix benchmarks
  • Loading branch information
shamb0t authored Nov 25, 2019
2 parents 5ca5fcb + 298e930 commit 859742d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test/keystore/
test-keys/
test/browser/bundle.js
test/browser/bundle.js.map
benchmarks/ipfs-log-benchmarks
ipfs-log-benchmarks/
examples/browser/bundle.js.map
examples/browser/ipfs.min.js
examples/browser/ipfslog.min.js
7 changes: 1 addition & 6 deletions benchmarks/benchmark-append.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ const Log = require('../src/log')
const IdentityProvider = require('orbit-db-identity-provider')
const Keystore = require('orbit-db-keystore')

const leveldown = require('leveldown')
const storage = require('orbit-db-storage-adapter')(leveldown)

// State
let ipfs
let log
Expand Down Expand Up @@ -56,9 +53,7 @@ let run = (() => {
// const memstore = new MemStore()
// ipfs.dag.put = memstore.put.bind(memstore)
// ipfs.dag.get = memstore.get.bind(memstore)
const signingKeysPath = './benchmarks/ipfs-log-benchmarks/keys1'
const store = await storage.createStore(signingKeysPath)
const keystore = new Keystore(store)
const keystore = new Keystore('./ipfs-log-benchmarks/keys/')
const identities = new IdentityProvider({ keystore })
const identity = await identities.createIdentity({ id: 'userA' })

Expand Down
8 changes: 2 additions & 6 deletions benchmarks/benchmark-from-entry-hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ const Log = require('../src/log')
const IdentityProvider = require('orbit-db-identity-provider')
const Keystore = require('orbit-db-keystore')

const leveldown = require('leveldown')
const storage = require('orbit-db-storage-adapter')(leveldown)
// State
let ipfs
let log
Expand All @@ -30,7 +28,7 @@ let run = (() => {
}

ipfs = new IPFS({
repo: new IPFSRepo('./ipfs-log-benchmarks/fromEntryHash/ipfs', repoConf),
repo: new IPFSRepo('./ipfs-log-benchmarks/ipfs', repoConf),
start: false,
EXPERIMENTAL: {
pubsub: false,
Expand All @@ -45,9 +43,7 @@ let run = (() => {

ipfs.on('ready', async () => {
// Create a log
const signingKeysPath = './benchmarks/ipfs-log-benchmarks/keys1'
const store = await storage.createStore(signingKeysPath)
const keystore = new Keystore(store)
const keystore = new Keystore('./ipfs-log-benchmarks/keys/')
const identities = new IdentityProvider({ keystore })
const identity = await identities.createIdentity({ id: 'userA' })

Expand Down
18 changes: 3 additions & 15 deletions benchmarks/benchmark-join.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ const Log = require('../src/log')
const IdentityProvider = require('orbit-db-identity-provider')
const Keystore = require('orbit-db-keystore')

const leveldown = require('leveldown')
const storage = require('orbit-db-storage-adapter')(leveldown)

// State
let ipfs
let log1, log2
Expand Down Expand Up @@ -66,20 +63,11 @@ let run = (() => {
// const memstore = new MemStore()
// ipfs.dag.put = memstore.put.bind(memstore)
// ipfs.dag.get = memstore.get.bind(memstore)
const keystore = new Keystore('./ipfs-log-benchmarks/keys/')

const signingKeysPath1 = './benchmarks/ipfs-log-benchmarks/keys1'
const signingKeysPath2 = './benchmarks/ipfs-log-benchmarks/keys2'
// const identity = await IdentityProvider.createIdentity({ id: 'userA', signingKeysPath1 })
// const identity2 = await IdentityProvider.createIdentity({ id: 'userB', signingKeysPath2 })

const store1 = await storage.createStore(signingKeysPath1)
const store2 = await storage.createStore(signingKeysPath2)
const keystore1 = new Keystore(store1)
const keystore2 = new Keystore(store2)

const identities = new IdentityProvider({ keystore: keystore1 })
const identities = new IdentityProvider({ keystore })
const identity = await identities.createIdentity({ id: 'userA' })
const identity2 = await identities.createIdentity({ id: 'userB', keystore: keystore2 })
const identity2 = await identities.createIdentity({ id: 'userB' })

log1 = new Log(ipfs, identity, identities, { logId: 'A' })
log2 = new Log(ipfs, identity2, identities, { logId: 'A' })
Expand Down
8 changes: 1 addition & 7 deletions benchmarks/benchmark-join2.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ const Log = require('../src/log')
const IdentityProvider = require('orbit-db-identity-provider')
const Keystore = require('orbit-db-keystore')

const leveldown = require('leveldown')
const storage = require('orbit-db-storage-adapter')(leveldown)

// State
let ipfs
let log1, log2
Expand Down Expand Up @@ -60,10 +57,7 @@ let run = (() => {
// const memstore = new MemStore()
// ipfs.dag.put = memstore.put.bind(memstore)
// ipfs.dag.get = memstore.get.bind(memstore)

const signingKeysPath = './benchmarks/ipfs-log-benchmarks/keys1'
const store = await storage.createStore(signingKeysPath)
const keystore = new Keystore(store)
const keystore = new Keystore('./benchmarks/ipfs-log-benchmarks/keys')
const identities = new IdentityProvider({ keystore })
const identity = await identities.createIdentity({ id: 'userA' })
const identity2 = await identities.createIdentity({ id: 'userB' })
Expand Down

0 comments on commit 859742d

Please sign in to comment.