Comments (2)
in addition to the PR #1488
i see a big change that can be made in iobuf by using const generics in the config for the segment size. As they do not change during runtime they could be type defined, and thus allow for safe
#[repr (C, align (8192))]
struct AlignedBuf<const N: usize>([u8; N])
then implement deref and deref mut and eliminate all of the pointer based unsafes, and at the same time allow the compiler to optimize range checks away during slice access.
The only hicup is the memset to zero as you can see here:
https://godbolt.org/z/PEj6h4YoP
it can be circumvented by a MaybeUninit and in that case the generated assembly is identical to the more unsafe version.
from sled.
turns out the modifications are impossible without removing the option to change the segment_size, rust nightly using const expressions or leaking an ugly const generic into every single struct of the library. Using an associated type in a config trait would more elegantly leak into all structs but doesn't allow for the advantages of arrays.
the most elegant solution is to simply remove the parameter, and the second best having a dyn io buffer that can be specialized with certain sizes.
I'll see if i can do that and make a benchmark to see if the difference is significant.
from sled.
Related Issues (20)
- `IoBuf::get_mut_range` unsoundly extends arbitrary lifetime to 'static HOT 2
- panic: cannot find pid in view_for_key, looking for key
- Hi I wanted to know if this project is dead? HOT 13
- Is there any GUI program to explore sled db
- Does Tree::transaction really need Fn instead of FnMut? HOT 3
- Data is not written durably HOT 1
- If the assertion goes into unwinding, the value will be leaked inside a panic.
- memory leak?
- Modify issues related to atomic::ordering usage
- support ttl or some callback mechanism to remove data automatically
- Storage issues when using high count of trees HOT 1
- document the fact zstd support is currently halfway removed
- VFS
- Is it safe to drop `Db` after `Tree`?
- Can `K` in `Tree::Range` be made `?Sized`?
- Add MSRV to `Cargo.toml`
- Preserve the insertion ordering HOT 1
- Bloodstone `Db::tree_names`
- Weak Db handle
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sled.