mirror of https://github.com/poanetwork/gecko.git
cache only contains vertices at height 5000, 10000, etc.
This commit is contained in:
parent
a3d3ef4787
commit
8b75abdee0
|
@ -17,7 +17,14 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
cacheSize = 100000
|
// We cache processed vertices where height = c * stripeDistance for c = {1,2,3...}
|
||||||
|
// This forms a "stripe" of cached DAG vertices at height stripeDistance, 2*stripeDistance, etc.
|
||||||
|
// This helps to limit the number of repeated DAG traversals performed
|
||||||
|
//
|
||||||
|
// With stripeDistance == 2500, average DAG width == 25 and processedCache size == 100,000
|
||||||
|
// the graph can have depth up to 10,000,000 and hold every stripe in cache (100,000 / 25 == x / 2,500)
|
||||||
|
stripeDistance = 2500
|
||||||
|
cacheSize = 100000
|
||||||
)
|
)
|
||||||
|
|
||||||
// BootstrapConfig ...
|
// BootstrapConfig ...
|
||||||
|
@ -175,6 +182,9 @@ func (b *bootstrapper) process(vtxs ...avalanche.Vertex) error {
|
||||||
toProcess.Push(parent)
|
toProcess.Push(parent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if vtx.Height()%stripeDistance == 0 {
|
||||||
|
b.processedCache.Put(vtx.ID(), nil)
|
||||||
|
}
|
||||||
b.processedCache.Put(vtx.ID(), nil)
|
b.processedCache.Put(vtx.ID(), nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue