You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 9, 2019. It is now read-only.
100,000 iterations and each iteration inserts/deletes 583 bytes.
push took 2.177376983 secs (median)
pop took 15.56463868 secs (median)
500,000 iterations and each iteration inserts/deletes 583 bytes.
push took 148.10161673 secs (median)
pop took 327.692383578 secs (median)
1000,000 iterations and each iteration inserts/deletes 583 bytes.
push took 220.086547771 secs (median)
pop took 2661.85252924 secs (median)
as you can see, 100,000 and 1 million look similar. i.e, the time difference(huge) between inserting x number of elements and deleting x number of elements.
while for 500,000 there is not a big difference. But Why????
is it something related to rebalancing during the deletes but if so why doesn't it show in 500,000 iterations?
Note: the transaction is only committed at the very end. the code is as follows:
num:=500000//the number of iterationsdb, err:=bolt.Open("test/testcow.db", 0777, nil)
iferr!=nil {
log.Fatal(err)
}
deferdb.Close()
tx, err2:=db.Begin(true)
iferr2!=nil {
log.Fatal(err2)
}
defertx.Rollback()
// Use the transaction...b, err3:=tx.CreateBucket([]byte("MyBucket"))
iferr3!=nil {
log.Fatal(err2)
}
//this loop runs the num iterations 20 times for calculating avg.form:=0; m<20; m++ {
start:=time.Now()
elapsed:=time.Since(start)
fori=0; i<num; i++ {
if(i%10000==0){
elapsed=time.Since(start)
log.Printf("%d process at .. %f", i,elapsed.Seconds())
}
b.Put([]byte(strconv.FormatInt(i,10)), []byte(workload))
}
log.Printf("%d push took %s", m,elapsed)
fmt.Println("push took ", elapsed.Seconds())
runtime.GC()
debug.FreeOSMemory()
time.Sleep(1*time.Second)
start=time.Now()
fori=0; i<num; i++ {
if(i%1000==0){
elapsed=time.Since(start)
log.Printf("%d process at ... %f", i,elapsed.Seconds())
}
b.Delete([]byte(strconv.FormatInt(i,10)))
}
elapsed=time.Since(start)
log.Printf("pop took %s", elapsed)
fmt.Println("pop took ", elapsed.Seconds())
runtime.GC()
debug.FreeOSMemory()
time.Sleep(1*time.Second)
}
iferr9:=tx.Commit(); err9!=nil {
log.Fatal(err9)
}
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
100,000 iterations and each iteration inserts/deletes 583 bytes.
push took 2.177376983 secs (median)
pop took 15.56463868 secs (median)
500,000 iterations and each iteration inserts/deletes 583 bytes.
push took 148.10161673 secs (median)
pop took 327.692383578 secs (median)
1000,000 iterations and each iteration inserts/deletes 583 bytes.
push took 220.086547771 secs (median)
pop took 2661.85252924 secs (median)
as you can see, 100,000 and 1 million look similar. i.e, the time difference(huge) between inserting x number of elements and deleting x number of elements.
while for 500,000 there is not a big difference. But Why????
is it something related to rebalancing during the deletes but if so why doesn't it show in 500,000 iterations?
Note: the transaction is only committed at the very end. the code is as follows:
The text was updated successfully, but these errors were encountered: