Actually, with the correct functions, Unsized pages are always slower than Sized pages (especially for writing)
[?]
Feb 3, 2021, 10:28 PM
AOX2XQISHGWNNAFBYRN44Q6AWG7H5DPBK5YMFHK42HQNZ2TMHEJQCDependencies
- [2]
AFKBHYVEComparing the two implementations of leaves (sized/unsized). Sized are faster for writes, slower for reads. - [3]
WS4ZQM4RDebugging, tests, etc. - [4]
APPY2E7MUnsized deletions + custom sizes back - [5]
PXF3R6SVImproving test coverage for btree::cursor - [6]
OP6SVMODResetting history - [7]
6UVFCERMFormatting, debugging, etc. - [8]
YWFYZNLZCleanup + inter-process concurrency - [9]
H3FVSQIQUnsized pages - [10]
JEHCE5FNAlignment in unsized splits - [11]
X3QVVQISMore debugging (del seems to work now) - [*]
UAQX27N4Tests
Change contents
- edit in sanakirja-core/src/btree/page_unsized.rs at line 112
debug!("update_left_child: {:?} {:?} {:?}",page,mutable,header(page.as_page())); - edit in sanakirja-core/src/btree/page_unsized.rs at line 117
debug!("new = {:?}", new); - edit in sanakirja-core/src/btree/page_unsized.rs at line 142
debug!("del: {:?} {:?}", page, l); - edit in sanakirja-core/src/btree/page_unsized.rs at line 397
debug!("set_cursor, {:?} lookup = {:?}", page.offset, lookup); - replacement in sanakirja-core/src/btree/page_unsized.rs at line 588
debug!("clone: {:?}", s);debug!("clone: {:?} {:?}", s, s.len()); - edit in sanakirja-core/src/btree/page_unsized.rs at line 594
debug!("ptr = {:?}", core::slice::from_raw_parts(ptr, 24)); - edit in sanakirja-core/src/btree/page_unsized/put.rs at line 57
{let hdr = header(new.0.as_page());assert_eq!(hdr.n() as u64 * 16, hdr.left_page() & 0xfff);} - replacement in sanakirja-core/src/btree/page_unsized/put.rs at line 108
page.data.as_ptr().add(HDR) as *const LeafOffset,page.data.as_ptr().add(HDR) as *const L::Offset, - edit in sanakirja-core/src/btree/page_unsized/put.rs at line 115
if uu == u {if let Some((k1, v1)) = k1v1 {alloc::<K, V, L>(current_page, k0, v0, 0, l0, &mut n);total += alloc_size(k0, v0) + L::extra_size();alloc::<K, V, L>(current_page, k1, v1, 0, r0, &mut n);total += alloc_size(k1, v1) + L::extra_size();} else {alloc::<K, V, L>(current_page, k0, v0, l0, r0, &mut n);total += alloc_size(k0, v0) + L::extra_size();}} - edit in sanakirja-core/src/btree/page_unsized/put.rs at line 129
debug!("{:?} {:?} {:?} {:?}", r, off, is_left, total);assert_ne!(off, 0); - replacement in sanakirja-core/src/btree/page_unsized/put.rs at line 152[3.31208]→[3.31208:31343](∅→∅),[3.31343]→[3.2685:2748](∅→∅),[3.2748]→[3.31414:31485](∅→∅),[3.31414]→[3.31414:31485](∅→∅),[3.31485]→[3.2749:2812](∅→∅),[3.2812]→[3.31556:31649](∅→∅),[3.31556]→[3.31556:31649](∅→∅),[3.31649]→[3.2813:2876](∅→∅),[3.2876]→[3.31720:31734](∅→∅),[3.31720]→[3.31720:31734](∅→∅)
if uu == u {if let Some((k1, v1)) = k1v1 {alloc::<K, V, L>(current_page, k0, v0, 0, l0, &mut n);total += alloc_size(k0, v0) + L::extra_size();alloc::<K, V, L>(current_page, k1, v1, 0, r0, &mut n);total += alloc_size(k1, v1) + L::extra_size();} else {alloc::<K, V, L>(current_page, k0, v0, l0, r0, &mut n);total += alloc_size(k0, v0) + L::extra_size();}}if u == s.len() {if let Some((k1, v1)) = k1v1 {alloc::<K, V, L>(current_page, k0, v0, 0, l0, &mut n);alloc::<K, V, L>(current_page, k1, v1, 0, r0, &mut n);} else {alloc::<K, V, L>(current_page, k0, v0, l0, r0, &mut n); - edit in sanakirja-core/src/btree/page_unsized/put.rs at line 160
}{let hdr = header(left.0.as_page());assert_eq!(hdr.n() as u64 * 16, hdr.left_page() & 0xfff);}{let hdr = header(right.0.as_page());assert_eq!(hdr.n() as u64 * 16, hdr.left_page() & 0xfff); - edit in sanakirja-core/src/btree/page_unsized/put.rs at line 169
- replacement in sanakirja-core/src/btree/page_unsized/alloc.rs at line 65
(HDR as usize) + (hdr.n() as usize) * 2 + 2 + size < hdr.data() as usizedebug!("can_alloc, leaf: {:?} {:?} {:?} {:?}",HDR,hdr.n() * 2,hdr.data(),size);(HDR as usize) + (hdr.n() as usize) * 2 + 2 + size <= hdr.data() as usize - replacement in sanakirja-core/src/btree/page_unsized/alloc.rs at line 76
"can_compact, internal: {:?} {:?} {:?}","can_compact, leaf: {:?} {:?} {:?}", - edit in sanakirja-core/src/btree/page_unsized/alloc.rs at line 81
assert_eq!(hdr.n() as u64 * 16, hdr.left_page() & 0xfff); // Just for the test with (u64, u64). - edit in sanakirja-core/src/btree/page_unsized/alloc.rs at line 113
assert!(HDR + hdr.n() as usize * 2 + 2 + size < data as usize); - replacement in sanakirja-core/src/btree/page_unsized/alloc.rs at line 180
(HDR as usize) + (hdr.n() as usize) * 8 + 8 + size < hdr.data() as usizedebug!("can_alloc, internal: {:?} {:?} {:?} {:?}",HDR,hdr.n() * 8,hdr.data(),size);(HDR as usize) + (hdr.n() as usize) * 8 + 8 + size <= hdr.data() as usize - edit in sanakirja-core/src/btree/page_unsized/alloc.rs at line 236
assert!(HDR + hdr.n() as usize * 8 + 8 + size <= data as usize); - edit in sanakirja-core/src/btree/page_unsized/alloc.rs at line 284
debug!("internal page {:?} {:?}", page, hdr.n()); - edit in sanakirja-core/src/btree/page.rs at line 431
debug!("set_cursor, {:?} lookup = {:?}", page.offset, lookup); - replacement in sanakirja/src/tests.rs at line 333
put(&mut txn, &mut db, &i, &i).unwrap();assert!(put(&mut txn, &mut db, &i, &i).unwrap()); - replacement in sanakirja/src/tests.rs at line 345
let mut n = 0;let mut err = 0; - replacement in sanakirja/src/tests.rs at line 349
n += 1err += 1 - replacement in sanakirja/src/tests.rs at line 352
assert_eq!(n, 0);assert_eq!(err, 0);println!("sized length = {:?}", txn.length >> 12); - edit in sanakirja/src/tests.rs at line 357
let n = 10_000_000u64; - replacement in sanakirja/src/tests.rs at line 359
put(&mut txn, &mut db, &i, &i).unwrap();assert!(put(&mut txn, &mut db, &i, &i).unwrap()); - edit in sanakirja/src/tests.rs at line 368
println!("unsized length = {:?}", txn.length >> 12); - replacement in sanakirja/src/environment/muttxn.rs at line 16
length: u64,pub(crate) length: u64,