Skip to content

Modified and reimplemented FastLanes library in C - #9941

Merged
dbeck merged 2 commits into
mainfrom
dbeck/fastlanes_pr
Jun 3, 2026
Merged

Modified and reimplemented FastLanes library in C#9941
dbeck merged 2 commits into
mainfrom
dbeck/fastlanes_pr

Conversation

@dbeck

@dbeck dbeck commented Jun 1, 2026

Copy link
Copy Markdown
Member

There is a background and intro document in tsl/src/compression/algorithms/fastlanes/README.md

The short version is: this change brings a C implementation of the FastLanes library to Timescale DB. The original idea is from 'The FastLanes Compression Layout: Decoding >100 Billion Integers per Second with Scalar Code' by Azim Afroozeh and Peter Boncz (https://doi.org/10.14778/3598581.3598587)

Our version departs from the original ideas in a few ways:

  • instead of having a single 1024 bit virtual register, I introduce multiple smaller register widths, that I call 'tiered FL', the widths are 8, 16, 32, 64, 128 and 256

  • we do not have 1024 bit virtual registers

  • our implementation relies on C macros, instead of C++ templates and code generation

The README.md file provides more details about the library.

The changelog file is disabled, as this change doesn't provide any useful functionality to the user on its own.
This change provides the basis for later compression algorithms to be introduced.

Disable-check: force-changelog-file

Co-authored-by: Sven Klemm 31455525+svenklemm@users.noreply.github.com
Signed-off-by: David Beck david.beck.priv@gmail.com

@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown

@melihmutlu, @pnthao: please review this pull request.

Powered by pull-review

@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

@dbeck
dbeck force-pushed the dbeck/fastlanes_pr branch 2 times, most recently from b4fdfb1 to 1498677 Compare June 1, 2026 11:14
Comment thread tsl/src/compression/algorithms/fastlanes/README.md
Comment thread tsl/src/compression/algorithms/fastlanes/README.md
Comment thread tsl/src/compression/algorithms/fastlanes/README.md Outdated
Comment thread tsl/src/compression/algorithms/fastlanes/README.md Outdated
@svenklemm

Copy link
Copy Markdown
Member

should this be on tsl side, where all the other compression stuff lives?

@dbeck

dbeck commented Jun 1, 2026

Copy link
Copy Markdown
Member Author

should this be on tsl side, where all the other compression stuff lives?

I'm hesitating on this. It logically belongs to the compression, but:

  • releasing this as TSL licensed code is not elegant as this is based on other people's ideas
  • and also the compression uses the src/adt/ stuff from the Apache codebase

Comment thread tsl/src/compression/algorithms/fastlanes/fl256.h Outdated
Comment thread test/sql/c_unit_tests.sql Outdated
Comment thread tsl/test/src/test_fl.c Outdated
Comment thread tsl/src/compression/algorithms/fastlanes/README.md Outdated
@dbeck
dbeck force-pushed the dbeck/fastlanes_pr branch from 4f3cb46 to 3803b9f Compare June 2, 2026 12:38
@dbeck

dbeck commented Jun 3, 2026

Copy link
Copy Markdown
Member Author

I am not going to fix the rest of codecov gaps, because they are either not reasonable or simply wrong

@akuzm

akuzm commented Jun 3, 2026

Copy link
Copy Markdown
Member

I am not going to fix the rest of codecov gaps, because they are either not reasonable or simply wrong

I think it makes sense to add Assert(false) to the unreachable default cases/returns. For partial coverage of test assert functions, probably need to add them to the exception list like I did for assertions #9195

@dbeck

dbeck commented Jun 3, 2026

Copy link
Copy Markdown
Member Author

I am not going to fix the rest of codecov gaps, because they are either not reasonable or simply wrong

I think it makes sense to add Assert(false) to the unreachable default cases/returns. For partial coverage of test assert functions, probably need to add them to the exception list like I did for assertions #9195

Thanks for the pointer, I now added the TestAssert.. stuff too, plus the Assert(false) guards.

@dbeck
dbeck force-pushed the dbeck/fastlanes_pr branch 2 times, most recently from 282bb2d to 8de352f Compare June 3, 2026 12:26

@akuzm akuzm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't read the algorithm code in detail, but I think we can proceed with merging it.

Comment thread tsl/src/compression/algorithms/fastlanes/README.md Outdated
Comment thread tsl/test/src/test_fastlanes.c
There is a background and intro document in src/fl/README.md

The short version is: this change brings a C implementation
of the FastLanes library to Timescale DB. The original idea
is from 'The FastLanes Compression Layout: Decoding >100 Billion
Integers per Second with Scalar Code' by Azim Afroozeh and
Peter Boncz (https://doi.org/10.14778/3598581.3598587)

Our version departs from the original ideas in a few ways:

- instead of having a single 1024 bit virtual register, I
  introduce multiple smaller register widths, that I call
  'tiered FL', the widths are 8, 16, 32, 64, 128 and 256

- we do not have 1024 bit virtual registers

- our implementation relies on C macros, instead of C++
  templates and code generation

The src/fl/README.md file provides more details about the
library.

Co-authored-by: Sven Klemm <31455525+svenklemm@users.noreply.github.com>
Signed-off-by: David Beck <david.beck.priv@gmail.com>
@dbeck
dbeck force-pushed the dbeck/fastlanes_pr branch from 3afb4be to 48556ac Compare June 3, 2026 18:20
@dbeck
dbeck enabled auto-merge (rebase) June 3, 2026 18:28
@dbeck
dbeck merged commit 24b7c83 into main Jun 3, 2026
60 checks passed
@dbeck
dbeck deleted the dbeck/fastlanes_pr branch June 3, 2026 18:41
@timescale-automation timescale-automation added the released-2.28.0 Released in 2.28.0 label Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released-2.28.0 Released in 2.28.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants