pijul nest
guest [sign in]

Actually, with the correct functions, Unsized pages are always slower than Sized pages (especially for writing)

[?]
Feb 3, 2021, 10:28 PM
AOX2XQISHGWNNAFBYRN44Q6AWG7H5DPBK5YMFHK42HQNZ2TMHEJQC

Dependencies

  • [2] AFKBHYVE Comparing the two implementations of leaves (sized/unsized). Sized are faster for writes, slower for reads.
  • [3] WS4ZQM4R Debugging, tests, etc.
  • [4] APPY2E7M Unsized deletions + custom sizes back
  • [5] PXF3R6SV Improving test coverage for btree::cursor
  • [6] OP6SVMOD Resetting history
  • [7] 6UVFCERM Formatting, debugging, etc.
  • [8] YWFYZNLZ Cleanup + inter-process concurrency
  • [9] H3FVSQIQ Unsized pages
  • [10] JEHCE5FN Alignment in unsized splits
  • [11] X3QVVQIS More debugging (del seems to work now)
  • [*] UAQX27N4 Tests

Change contents

  • edit in sanakirja-core/src/btree/page_unsized.rs at line 112
    [3.4814][3.4814:4964]()
    debug!(
    "update_left_child: {:?} {:?} {:?}",
    page,
    mutable,
    header(page.as_page())
    );
  • edit in sanakirja-core/src/btree/page_unsized.rs at line 117
    [3.5165][3.5165:5204]()
    debug!("new = {:?}", new);
  • edit in sanakirja-core/src/btree/page_unsized.rs at line 142
    [3.1340][3.6078:6121](),[3.6078][3.6078:6121]()
    debug!("del: {:?} {:?}", page, l);
  • edit in sanakirja-core/src/btree/page_unsized.rs at line 397
    [3.15321][3.15321:15396]()
    debug!("set_cursor, {:?} lookup = {:?}", page.offset, lookup);
  • replacement in sanakirja-core/src/btree/page_unsized.rs at line 588
    [3.21429][3.21429:21467]()
    debug!("clone: {:?}", s);
    [3.21429]
    [3.21467]
    debug!("clone: {:?} {:?}", s, s.len());
  • edit in sanakirja-core/src/btree/page_unsized.rs at line 594
    [3.21704][3.21704:21784]()
    debug!("ptr = {:?}", core::slice::from_raw_parts(ptr, 24));
  • edit in sanakirja-core/src/btree/page_unsized/put.rs at line 57
    [3.28946]
    [3.28946]
    {
    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
    [3.30106][3.30106:30168]()
    page.data.as_ptr().add(HDR) as *const LeafOffset,
    [3.30106]
    [3.30168]
    page.data.as_ptr().add(HDR) as *const L::Offset,
  • edit in sanakirja-core/src/btree/page_unsized/put.rs at line 115
    [3.30307]
    [3.30307]
    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
    [3.30357]
    [3.30357]
    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();
    }
    [3.31208]
    [3.31734]
    }
    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
    [3.31744]
    [3.31744]
    }
    {
    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
    [3.31750]
    [3.31750]
  • replacement in sanakirja-core/src/btree/page_unsized/alloc.rs at line 65
    [3.3236][3.3236:3317]()
    (HDR as usize) + (hdr.n() as usize) * 2 + 2 + size < hdr.data() as usize
    [3.3236]
    [3.36212]
    debug!(
    "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
    [3.3390][3.3390:3443]()
    "can_compact, internal: {:?} {:?} {:?}",
    [3.3390]
    [3.3443]
    "can_compact, leaf: {:?} {:?} {:?}",
  • edit in sanakirja-core/src/btree/page_unsized/alloc.rs at line 81
    [3.3525]
    [3.3525]
    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
    [3.4008]
    [3.4008]
    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
    [3.4260][3.39861:39942](),[3.39861][3.39861:39942]()
    (HDR as usize) + (hdr.n() as usize) * 8 + 8 + size < hdr.data() as usize
    [3.4260]
    [3.39942]
    debug!(
    "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
    [3.4826]
    [3.4826]
    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
    [3.43162]
    [3.43162]
    debug!("internal page {:?} {:?}", page, hdr.n());
  • edit in sanakirja-core/src/btree/page.rs at line 431
    [3.9111][3.634:709]()
    debug!("set_cursor, {:?} lookup = {:?}", page.offset, lookup);
  • replacement in sanakirja/src/tests.rs at line 333
    [3.12041][3.12041:12090]()
    put(&mut txn, &mut db, &i, &i).unwrap();
    [3.12041]
    [3.12090]
    assert!(put(&mut txn, &mut db, &i, &i).unwrap());
  • replacement in sanakirja/src/tests.rs at line 345
    [3.12418][3.12418:12437]()
    let mut n = 0;
    [3.12418]
    [3.12437]
    let mut err = 0;
  • replacement in sanakirja/src/tests.rs at line 349
    [3.12538][3.12538:12557]()
    n += 1
    [3.12538]
    [3.12557]
    err += 1
  • replacement in sanakirja/src/tests.rs at line 352
    [3.12573][3.12573:12595]()
    assert_eq!(n, 0);
    [3.12573]
    [2.412]
    assert_eq!(err, 0);
    println!("sized length = {:?}", txn.length >> 12);
  • edit in sanakirja/src/tests.rs at line 357
    [3.12738][2.414:441]()
    let n = 10_000_000u64;
  • replacement in sanakirja/src/tests.rs at line 359
    [2.489][3.12782:12831](),[3.12782][3.12782:12831]()
    put(&mut txn, &mut db, &i, &i).unwrap();
    [2.489]
    [3.12831]
    assert!(put(&mut txn, &mut db, &i, &i).unwrap());
  • edit in sanakirja/src/tests.rs at line 368
    [2.760]
    [3.12890]
    println!("unsized length = {:?}", txn.length >> 12);
  • replacement in sanakirja/src/environment/muttxn.rs at line 16
    [3.80367][3.80367:80384]()
    length: u64,
    [3.80367]
    [3.1290]
    pub(crate) length: u64,