aboutsummaryrefslogtreecommitdiff
path: root/db.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-06-30 08:01:41 -0600
committerBen Johnson <benbjohnson@yahoo.com>2014-06-30 08:01:41 -0600
commitdef455554b5607ec6ccd0af51d0dea5401003e93 (patch)
tree3c866e1b594f37ae317218b3ba94965592ae8646 /db.go
parentMerge pull request #214 from Shopify/fix_stats_sub (diff)
downloaddedo-def455554b5607ec6ccd0af51d0dea5401003e93.tar.gz
dedo-def455554b5607ec6ccd0af51d0dea5401003e93.tar.xz
Add freelist cache.
This commit adds a cache to the freelist which combines the available free pages and pending free pages in a single map. This was added to improve performance where freelist.isFree() was consuming 70% of CPU time for large freelists.
Diffstat (limited to 'db.go')
-rw-r--r--db.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/db.go b/db.go
index 6ef35ea..4d7ec12 100644
--- a/db.go
+++ b/db.go
@@ -144,7 +144,7 @@ func Open(path string, mode os.FileMode, options *Options) (*DB, error) {
}
// Read in the freelist.
- db.freelist = &freelist{pending: make(map[txid][]pgid)}
+ db.freelist = newFreelist()
db.freelist.read(db.page(db.meta().freelist))
// Mark the database as opened and return.