Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A simple integer compression library in Java

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

JavaFastPFOR: A simple integer compression library in Java Build Status


This code is released under the Apache License Version 2.0

What does this do?

It is a library to compress and uncompress arrays of integers very fast. The assumption is that most (but not all) values in your array use less than 32 bits. These sort of arrays often come up when using differential coding in databases and information retrieval (e.g., in inverted indexes or column stores).

This libary is used by ClueWeb Tools (

It is a java port of the fastpfor C++ library ( There is also a Go port ( The C++ library is used by the zsearch engine ( as well as in GMAP and GSNAP (

Some CODECs ("integrated codecs") assume that the integers are in sorted orders. Most others do not.

Maven central repository

Using this code in your own project is easy with maven, just add the following code in your pom.xml file:


Naturally, you should replace "version" by the version you desire.

You can also download JavaFastPFOR from the Maven central repository:


We found no library that implemented state-of-the-art integer coding techniques such as Binary Packing, NewPFD, OptPFD, Variable Byte, Simple 9 and so on in Java. We wrote one.


Main contributors

with contributions by

How does it compare to the Kamikaze PForDelta library?

In our tests, Kamikaze PForDelta does not fare well. See the benchmarkresults directory for some results.


A recent Java compiler. Java 7 or better is recommended.

Good instructions on installing Java 7 on Linux:


See for a simple demonstration.

How fast is it?

Compile the code and execute me.lemire.integercompression.Benchmark.

I recommend running all the benchmarks with the "-server" flag on a desktop machine.

Speed is always reported in millions of integers per second.

For Maven users

mvn compile

mvn exec:java

For ant users

If you use Apache ant, please try this:

$ ant Benchmark


$ ant Benchmark

Want to read more?

We wrote a research paper which documents many of the CODECs implemented here:

Daniel Lemire and Leonid Boytsov, Decoding billions of integers per second through vectorization, Software Pratice & Experience (to appear)

Something went wrong with that request. Please try again.