Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delta lookback #248

Merged
merged 39 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
944f54a
per latent var, starting refactors
mwlon Oct 27, 2024
5df4334
some fixes
mwlon Oct 28, 2024
f939ae3
as_ref and as_mut
mwlon Oct 28, 2024
9fc584a
progress
mwlon Oct 28, 2024
e70caf7
metadata update
mwlon Oct 29, 2024
0969d45
progress
mwlon Oct 30, 2024
00fe34c
merge
mwlon Nov 1, 2024
f647355
progress
mwlon Nov 2, 2024
78a7736
mostly there
mwlon Nov 2, 2024
494c5da
almost working
mwlon Nov 3, 2024
908180c
quite possibly working
mwlon Nov 3, 2024
9aceab2
fixes
mwlon Nov 3, 2024
02ae77a
actually working
mwlon Nov 3, 2024
e93a67c
improvements
mwlon Nov 3, 2024
0daea5a
lints
mwlon Nov 3, 2024
f3ef36a
less absurd setting
mwlon Nov 3, 2024
9b74f21
practical performance, sorta
mwlon Nov 5, 2024
e20a665
delta speed improvements
mwlon Nov 6, 2024
092110e
better lookback alg
mwlon Nov 6, 2024
e8eb23e
improvements
mwlon Nov 8, 2024
53bb3b6
settled on delta lookback algorithm
mwlon Nov 8, 2024
1c9bf2a
cleaning
mwlon Nov 8, 2024
4867310
fixed tests
mwlon Nov 8, 2024
62e1ea9
fixes
mwlon Nov 8, 2024
52b738c
comments and cleanup and clarifications and corrections
mwlon Nov 9, 2024
d7b9ac8
more touch ups
mwlon Nov 9, 2024
7d50ad7
improvements
mwlon Nov 9, 2024
8d8fc9c
touch up
mwlon Nov 9, 2024
71f3bda
tweaks
mwlon Nov 9, 2024
fac3546
tweaks
mwlon Nov 9, 2024
83d99f6
compatibility test
mwlon Nov 9, 2024
d17c227
skip auto lz if hopeless
mwlon Nov 9, 2024
33427ce
final touch ups?
mwlon Nov 9, 2024
c9814ba
reduced binary size about 60kb
mwlon Nov 9, 2024
f7d4344
real world bench update
mwlon Nov 9, 2024
51cf3af
documentation
mwlon Nov 9, 2024
fcc6c29
lookback instead of lz77
mwlon Nov 9, 2024
e11d165
non exhaustive dtype dispatch
mwlon Nov 9, 2024
c3768ed
unstable api
mwlon Nov 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/benchmark_results/mbp_m3_max.csv
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
input,codec,compress_dt,decompress_dt,compressed_size
air_quality,blosc:cname=zstd:level=3,0.104805835,0.028497249,8429280
air_quality,parquet:compression=zstd1,0.2296,0.02594,11156819
air_quality,pco,0.10299417,0.021796916,4283105
air_quality,pco,0.11510511,0.022027887,4283153
air_quality,spdp,0.09585233,0.10599508,22560633
air_quality,tpfor,0.029559456,0.002875309,19114630
r_place,blosc:cname=zstd:level=3,11.372147,3.3396413,976973046
r_place,parquet:compression=zstd1,15.389868,1.9258637,961718183
r_place,pco,10.476611,1.5533803,661664577
r_place,pco,11.368066,1.5747843,661665164
r_place,spdp,11.464923,12.225844,3306514546
r_place,tpfor,2.5569496,0.5739353,2023272462
taxi,blosc:cname=zstd:level=3,6.3025703,1.8824589,841110760
taxi,parquet:compression=zstd1,5.600355,0.9174722,464867099
taxi,pco,5.3043575,0.8830483,333004373
taxi,pco,5.6141233,0.8759089,333004631
taxi,spdp,4.5603795,5.0574136,1636214754
taxi,tpfor,1.0123023,0.24857067,1452549995
41 changes: 33 additions & 8 deletions dtype_dispatch/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![doc = include_str!("../README.md")]
#![allow(unreachable_patterns)]

/// Produces two macros: an enum definer and an enum matcher.
///
Expand All @@ -15,17 +16,38 @@ macro_rules! build_dtype_macros {
) => {
$(#[$definer_attrs])*
macro_rules! $definer {
(#[$enum_attrs: meta] $vis: vis $name: ident) => {
#[$enum_attrs]
#[non_exhaustive]
$vis enum $name {
$($variant,)+
}

impl $name {
#[inline]
pub fn new<T: $constraint>() -> Option<Self> {
let type_id = std::any::TypeId::of::<T>();
$(
if type_id == std::any::TypeId::of::<$t>() {
return Some($name::$variant);
}
)+
None
}
}
};
(#[$enum_attrs: meta] #[repr($desc_t: ty)] $vis: vis $name: ident = $desc_val: ident) => {
#[$enum_attrs]
#[repr($desc_t)]
#[non_exhaustive]
$vis enum $name {
$($variant = <$t>::$desc_val,)+
}

impl $name {
#[inline]
pub fn new<S: $constraint>() -> Option<Self> {
let type_id = std::any::TypeId::of::<S>();
pub fn new<T: $constraint>() -> Option<Self> {
let type_id = std::any::TypeId::of::<T>();
$(
if type_id == std::any::TypeId::of::<$t>() {
return Some($name::$variant);
Expand All @@ -50,6 +72,7 @@ macro_rules! build_dtype_macros {
}

#[$enum_attrs]
#[non_exhaustive]
$vis enum $name {
$($variant($container<$t>),)+
}
Expand Down Expand Up @@ -106,26 +129,26 @@ macro_rules! build_dtype_macros {
None
}

pub fn downcast<S: $constraint>(self) -> Option<$container<S>> {
pub fn downcast<T: $constraint>(self) -> Option<$container<T>> {
match self {
$(
Self::$variant(inner) => inner.downcast::<S>(),
Self::$variant(inner) => inner.downcast::<T>(),
)+
}
}

pub fn downcast_ref<S: $constraint>(&self) -> Option<&$container<S>> {
pub fn downcast_ref<T: $constraint>(&self) -> Option<&$container<T>> {
match self {
$(
Self::$variant(inner) => inner.downcast_ref::<S>(),
Self::$variant(inner) => inner.downcast_ref::<T>(),
)+
}
}

pub fn downcast_mut<S: $constraint>(&mut self) -> Option<&mut $container<S>> {
pub fn downcast_mut<T: $constraint>(&mut self) -> Option<&mut $container<T>> {
match self {
$(
Self::$variant(inner) => inner.downcast_mut::<S>(),
Self::$variant(inner) => inner.downcast_mut::<T>(),
)+
}
}
Expand All @@ -141,6 +164,7 @@ macro_rules! build_dtype_macros {
type $generic = $t;
$block
})+
_ => unreachable!()
}
};
($value: expr, $enum_: ident<$generic: ident>($inner: ident) => $block: block) => {
Expand All @@ -149,6 +173,7 @@ macro_rules! build_dtype_macros {
type $generic = $t;
$block
})+
_ => unreachable!()
}
};
}
Expand Down
34 changes: 17 additions & 17 deletions images/real_world_compression_ratio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading