diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2015-01-30 14:15:49 -0500 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2015-01-30 14:15:49 -0500 |
commit | b4d00c394a1feb8b2c6404e01be891e4a997ef35 (patch) | |
tree | 808df0d71e9c94045d2e8b30be7b1d5256a34c3f /db.go | |
parent | Merge pull request #292 from benbjohnson/fix-size (diff) | |
download | dedo-b4d00c394a1feb8b2c6404e01be891e4a997ef35.tar.gz dedo-b4d00c394a1feb8b2c6404e01be891e4a997ef35.tar.xz |
Expand assertion statements.
This commit expands calls to _assert() that use variadic arguments. These calls require conversion to interface{} so there
was a large number of calls to Go's internal convT2E() function. In some profiling this was taking over 20% of total runtime.
I don't remember seeing this before Go 1.4 so perhaps something has changed.
Diffstat (limited to 'db.go')
-rw-r--r-- | db.go | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -664,9 +664,11 @@ func (m *meta) copy(dest *meta) { // write writes the meta onto a page. func (m *meta) write(p *page) { - - _assert(m.root.root < m.pgid, "root bucket pgid (%d) above high water mark (%d)", m.root.root, m.pgid) - _assert(m.freelist < m.pgid, "freelist pgid (%d) above high water mark (%d)", m.freelist, m.pgid) + if m.root.root >= m.pgid { + panic(fmt.Sprintf("root bucket pgid (%d) above high water mark (%d)", m.root.root, m.pgid)) + } else if m.freelist >= m.pgid { + panic(fmt.Sprintf("freelist pgid (%d) above high water mark (%d)", m.freelist, m.pgid)) + } // Page id is either going to be 0 or 1 which we can determine by the transaction ID. p.id = pgid(m.txid % 2) |