I'm a software engineer and designer making a plethora of creative works.
nvzqz / byte-set-rs Goto Github PK
View Code? Open in Web Editor NEWEfficient sets of bytes for Rust
Home Page: https://docs.rs/byte_set
License: Apache License 2.0
Efficient sets of bytes for Rust
Home Page: https://docs.rs/byte_set
License: Apache License 2.0
We should be able to create a ByteSet
from a..b
or a..=b
where a
and b
are u8
, and have it be usable in const
.
The API should look like:
const fn from_range(range: std::ops::Range<u8>) -> ByteSet
const fn from_range_inclusive(range: std::ops::RangeInclusive<u8>) -> ByteSet
I expect this would be implemented via bit tricks over the integer chunk representation.
It would be nice if, at least for every tagged release, the entire benchmark suite could be automatically run. Then results could live at e.g. https://nvzqz.github.io/byte-set-rs/benchmarks/v0.1.0/ and https://nvzqz.github.io/byte-set-rs/benchmarks/latest/.
There are comparison benchmarks between ByteSet
and the following types:
[bool; 256]
BinaryHeap<u8>
BTreeSet<u8>
HashSet<u8>
InclusiveRange<u8>
Vec<u8>
What other types should be compared against?
There are currently no guarantees about ByteSet
's internal memory representation. Each byte should always map to a specific bit across compatible versions when targeting the same architecture.
This would enable the library to be ported to other languages (e.g. C, C++, D, Swift) and have the same instance be sent directly across each language.
Properties that are allowed to change the representation are:
This allows for various optimizations while still being consistent.
ByteSet
is composed of [u64; 4]
or [u32; 8]
depending on the target architecture (determined in build.rs
).
Currently, chunk size is based only on native register size. ByteSet
should expanded be to use 64-bit chunks on 32-bit targets with meaningful 64-bit instructions.
Consider (and benchmark!):
neon
target featureThe PartialOrd
and Ord
implementations should take advantage of the internal representation to improve performance.
The std::bitset<256>
type in C++ is comparable to ByteSet
.
ByteSet |
std::bitset<256> |
---|---|
contains |
test |
insert |
set |
remove |
reset |
len |
count |
is_empty |
none |
Considerations:
I think this is worth implementing and adding to #1.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.