Giter Club home page Giter Club logo

maskedvbyte's Introduction

MaskedVByte

Ubuntu 22.04 CI (GCC 11)

Fast decoder for VByte-compressed integers in C.

It includes fast differential coding.

We require x64 processors support SSE 4.1 or better. This includes virtually all x64 processors in service today, except for very old or specialized processors.

The code should build using most standard-compliant modern C compilers (C99). The provided makefile expects a Linux-like system.

Usage:

  make
  ./unit 

See example.c for an example.

Short code sample:

size_t compsize = vbyte_encode(datain, N, compressedbuffer); // encoding
// here the result is stored in compressedbuffer using compsize bytes
size_t compsize2 = masked_vbyte_decode(compressedbuffer, recovdata, N); // decoding (fast)

Interesting applications

Greg Bowyer has integrated Masked VByte into Lucene, for higher speeds :

https://github.com/GregBowyer/lucene-solr/tree/intrinsics

Reference

  • Daniel Lemire, Nathan Kurz, Christoph Rupp, Stream VByte: Faster Byte-Oriented Integer Compression, Information Processing Letters 130, February 2018, Pages 1-6 https://arxiv.org/abs/1709.08990
  • Jeff Plaisance, Nathan Kurz, Daniel Lemire, Vectorized VByte Decoding, International Symposium on Web Algorithms 2015, 2015. http://arxiv.org/abs/1503.07387

See also

maskedvbyte's People

Contributors

amallia avatar lemire avatar nkurz avatar pps83 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

maskedvbyte's Issues

Incorrect statement in

Hi,

// If the input is unsorted, then the result of the differential coding will be undefined as per the C spec.

If the input is unsorted, then the result of the differential coding will be undefined as per the C spec

I see this was added as a result of #1; however, unsigned underflow it is not undefined per C. clang -fsanitize=integer is just aggressively warning about possible problems in code that does not expect over/underflow, even when the standard permits it.

The result of naive differential coding is not Undefined Behavior; just an inefficient 5-byte representation when one element is slightly smaller than the previous.

Cheers,
Conrad

clang -fsanitize=integer warnings

I built with CC="clang -fsanitize=integer" on my system and while all the tests pass I do see:

src/unit.c:50:21: runtime error: unsigned integer overflow: 387420489 * 12 cannot be represented in type 'unsigned int'
src/varintencode.c:7:30: runtime error: unsigned integer overflow: 354078572 - 4261625379 cannot be represented in type 'unsigned int'
src/varintdecode.c:297:8: runtime error: unsigned integer overflow: 4261625379 + 387420489 cannot be represented in type 'unsigned int'
src/varintdecode.c:1748:10: runtime error: unsigned integer overflow: 4261625379 + 387420489 cannot be represented in type 'unsigned int'
src/varintdecode.c:292:9: runtime error: unsigned integer overflow: 4261625379 + 129140163 cannot be represented in type 'unsigned int'

Full log of make test: https://gist.github.com/springmeyer/822b0676d0dc2823db38

Feel free to dismiss this issue. I just wanted to share the first things I noticed.

For reference: I have source built clang version 3.7.0 (http://llvm.org/git/clang.git f37e15f9a5714657598ff06247376cf990e73a50) (http://llvm.org/git/llvm.git d0872b393c76547945a8cedd28cbfe50b6764ae9)

Dead code in multiple functions, differences between implementations

A line before that makes this entire large block useless:

		if (availablebytes < 16) break;

		if (availablebytes < 16) { /* dead code */

Then, multiple functions are almost identical copies with minor changes. For example, masked_vbyte_decode vs masked_vbyte_decode_delta. masked_vbyte_decode_delta has this if (availablebytes < 16) break;, while masked_vbyte_decode doesn't have it (similar loop with the break is inside masked_vbyte_select_delta).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.