Merge branch 'log_database' into b
Comparison of b against GoLLRB (as at d5f020). $ benchcmp gollrb.bench b-gen.bench benchmark old ns/op new ns/op delta BenchmarkNamePredicate 1631932 1409531 -13.63% BenchmarkLargeSetsNoIntersection 190792654 63748682 -66.59% BenchmarkVeryLargeSetsSmallIntersection 896154437 373475843 -58.32% BenchmarkHelplessContainsChecker 20719182678 14078301640 -32.05% BenchmarkNetAndSpeed 32519019 20188665 -37.92% BenchmarkKeanuAndNet 18319247 15224988 -16.89% BenchmarkKeanuAndSpeed 30849568 18744134 -39.24% BenchmarkKeanuOther 105552525 107620648 +1.96% BenchmarkKeanuBullockOther 295395338 115193002 -61.00% benchmark old allocs new allocs delta BenchmarkNamePredicate 1339 1341 +0.15% BenchmarkLargeSetsNoIntersection 22585 23632 +4.64% BenchmarkVeryLargeSetsSmallIntersection 65776 69396 +5.50% BenchmarkHelplessContainsChecker 1713541 2036316 +18.84% BenchmarkNetAndSpeed 17104 17240 +0.80% BenchmarkKeanuAndNet 15816 15855 +0.25% BenchmarkKeanuAndSpeed 16368 16493 +0.76% BenchmarkKeanuOther 30134 30634 +1.66% BenchmarkKeanuBullockOther 35510 36454 +2.66% benchmark old bytes new bytes delta BenchmarkNamePredicate 96162 96294 +0.14% BenchmarkLargeSetsNoIntersection 1172356 1249872 +6.61% BenchmarkVeryLargeSetsSmallIntersection 2810080 2992409 +6.49% BenchmarkHelplessContainsChecker 89233264 104999088 +17.67% BenchmarkNetAndSpeed 1388793 1428110 +2.83% BenchmarkKeanuAndNet 1263145 1250079 -1.03% BenchmarkKeanuAndSpeed 1246956 1281546 +2.77% BenchmarkKeanuOther 2021312 2024727 +0.17% BenchmarkKeanuBullockOther 2671448 2742968 +2.68% Conflicts: graph/memstore/triplestore.go
This commit is contained in:
commit
c618e556f4
12 changed files with 113 additions and 125 deletions
|
|
@ -35,17 +35,17 @@ func NewMemstoreNodesAllIterator(ts *TripleStore) *NodesAllIterator {
|
|||
}
|
||||
|
||||
// No subiterators.
|
||||
func (nit *NodesAllIterator) SubIterators() []graph.Iterator {
|
||||
func (it *NodesAllIterator) SubIterators() []graph.Iterator {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (nit *NodesAllIterator) Next() bool {
|
||||
if !nit.Int64.Next() {
|
||||
func (it *NodesAllIterator) Next() bool {
|
||||
if !it.Int64.Next() {
|
||||
return false
|
||||
}
|
||||
_, ok := nit.ts.revIdMap[nit.Int64.Result().(int64)]
|
||||
_, ok := it.ts.revIdMap[it.Int64.Result().(int64)]
|
||||
if !ok {
|
||||
return nit.Next()
|
||||
return it.Next()
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ func newTripleStore() *TripleStore {
|
|||
}
|
||||
}
|
||||
|
||||
func (ts *TripleStore) ApplyDeltas(deltas []*graph.Delta) error {
|
||||
func (ts *TripleStore) ApplyDeltas(deltas []graph.Delta) error {
|
||||
for _, d := range deltas {
|
||||
var err error
|
||||
if d.Action == graph.Add {
|
||||
|
|
@ -144,12 +144,12 @@ func (ts *TripleStore) indexOf(t quad.Quad) (int64, bool) {
|
|||
return 0, false
|
||||
}
|
||||
|
||||
func (ts *TripleStore) AddDelta(d *graph.Delta) error {
|
||||
func (ts *TripleStore) AddDelta(d graph.Delta) error {
|
||||
if _, exists := ts.indexOf(d.Quad); exists {
|
||||
return graph.ErrQuadExists
|
||||
}
|
||||
qid := ts.quadIdCounter
|
||||
ts.log = append(ts.log, LogEntry{Delta: *d})
|
||||
ts.log = append(ts.log, LogEntry{Delta: d})
|
||||
ts.size++
|
||||
ts.quadIdCounter++
|
||||
|
||||
|
|
@ -178,14 +178,14 @@ func (ts *TripleStore) AddDelta(d *graph.Delta) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (ts *TripleStore) RemoveDelta(d *graph.Delta) error {
|
||||
func (ts *TripleStore) RemoveDelta(d graph.Delta) error {
|
||||
prevQuadID, exists := ts.indexOf(d.Quad)
|
||||
if !exists {
|
||||
return graph.ErrQuadNotExist
|
||||
}
|
||||
|
||||
quadID := ts.quadIdCounter
|
||||
ts.log = append(ts.log, LogEntry{Delta: *d})
|
||||
ts.log = append(ts.log, LogEntry{Delta: d})
|
||||
ts.log[prevQuadID].DeletedBy = quadID
|
||||
ts.size--
|
||||
ts.quadIdCounter++
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue