<s>
rzip	B-Application
is	O
a	O
huge-scale	O
data	B-General_Concept
compression	I-General_Concept
computer	B-Application
program	I-Application
designed	O
around	O
initial	O
LZ77-style	O
string	O
matching	O
on	O
a	O
900MB	O
dictionary	O
window	O
,	O
followed	O
by	O
bzip2-based	O
Burrows	B-Algorithm
–	I-Algorithm
Wheeler	I-Algorithm
transform	I-Algorithm
and	O
entropy	O
coding	O
(	O
Huffman	B-General_Concept
)	O
on	O
900kB	O
output	O
chunks	O
.	O
</s>
<s>
rzip	B-Application
operates	O
in	O
two	O
stages	O
.	O
</s>
<s>
The	O
second	O
stage	O
uses	O
a	O
standard	O
compression	B-General_Concept
algorithm	I-General_Concept
(	O
bzip2	B-Application
)	O
to	O
compress	O
the	O
output	O
of	O
the	O
first	O
stage	O
.	O
</s>
<s>
It	O
is	O
also	O
common	O
to	O
have	O
a	O
single	O
file	O
that	O
contains	O
large	O
duplicated	O
chunks	O
over	O
long	O
distances	O
,	O
such	O
as	O
PDF	B-Application
files	I-Application
containing	O
repeated	O
copies	O
of	O
the	O
same	O
image	O
.	O
</s>
<s>
Most	O
compression	B-General_Concept
programs	I-General_Concept
wo	O
n't	O
be	O
able	O
to	O
take	O
advantage	O
of	O
this	O
redundancy	O
,	O
and	O
thus	O
might	O
achieve	O
a	O
much	O
lower	O
compression	O
ratio	O
than	O
rzip	B-Application
can	O
achieve	O
.	O
</s>
<s>
A	O
rolling-checksum	O
algorithm	O
based	O
on	O
the	O
one	O
in	O
rsync	B-Application
is	O
used	O
to	O
locate	O
potential	O
matches	O
from	O
over	O
such	O
a	O
large	O
dataset	O
.	O
</s>
<s>
The	O
key	O
difference	O
between	O
rzip	B-Application
and	O
other	O
well	O
known	O
compression	B-General_Concept
algorithms	I-General_Concept
is	O
its	O
ability	O
to	O
take	O
advantage	O
of	O
very	O
long	O
distance	O
redundancy	O
.	O
</s>
<s>
The	O
well	O
known	O
deflate	B-Algorithm
algorithm	O
used	O
in	O
gzip	B-Application
uses	O
a	O
maximum	O
history	O
buffer	O
of	O
32KiB	O
.	O
</s>
<s>
The	O
Burrows	B-Algorithm
–	I-Algorithm
Wheeler	I-Algorithm
transform	I-Algorithm
block	B-Algorithm
sorting	I-Algorithm
algorithm	O
used	O
in	O
bzip2	B-Application
is	O
limited	O
to	O
900KiB	O
of	O
history	O
.	O
</s>
<s>
The	O
history	O
buffer	O
in	O
rzip	B-Application
can	O
be	O
up	O
to	O
900MiB	O
long	O
,	O
several	O
orders	O
of	O
magnitude	O
larger	O
than	O
gzip	B-Application
or	O
bzip2	B-Application
.	O
</s>
<s>
Rzip	B-Application
is	O
often	O
much	O
faster	O
than	O
bzip2	B-Application
,	O
despite	O
using	O
the	O
bzip2	B-Application
library	O
as	O
a	O
back	O
end	O
.	O
</s>
<s>
This	O
is	O
because	O
rzip	B-Application
feeds	O
bzip2	B-Application
with	O
shrunken	O
data	O
,	O
so	O
that	O
bzip2	B-Application
has	O
to	O
do	O
less	O
work	O
.	O
</s>
<s>
rzip	B-Application
is	O
not	O
suited	O
for	O
every	O
purpose	O
.	O
</s>
<s>
The	O
two	O
biggest	O
disadvantages	O
of	O
rzip	B-Application
are	O
that	O
it	O
cannot	O
be	O
pipelined	O
(	O
so	O
it	O
cannot	O
read	O
from	O
standard	O
input	O
or	O
write	O
to	O
standard	O
output	O
)	O
,	O
and	O
that	O
it	O
uses	O
a	O
high	O
amount	O
of	O
memory	O
:	O
a	O
typical	O
compression	O
run	O
on	O
a	O
large	O
file	O
might	O
use	O
hundreds	O
of	O
megabytes	O
of	O
RAM	B-Architecture
.	O
</s>
<s>
If	O
there	O
is	O
a	O
lot	O
of	O
RAM	B-Architecture
to	O
spare	O
and	O
a	O
very	O
high	O
compression	O
ratio	O
is	O
required	O
,	O
rzip	B-Application
should	O
be	O
used	O
,	O
but	O
if	O
these	O
conditions	O
are	O
not	O
satisfied	O
,	O
alternate	O
compression	O
methods	O
such	O
as	O
gzip	B-Application
and	O
bzip2	B-Application
,	O
which	O
are	O
less	O
memory-intensive	O
,	O
should	O
be	O
used	O
instead	O
of	O
rzip	B-Application
.	O
</s>
<s>
rzip	B-Application
was	O
originally	O
written	O
by	O
Andrew	O
Tridgell	O
as	O
part	O
of	O
his	O
PhD	O
research	O
.	O
</s>
<s>
lrzip	O
(	O
Long	O
Range	O
ZIP	O
)	O
is	O
an	O
improved	O
version	O
of	O
rzip	B-Application
.	O
</s>
<s>
Its	O
file	O
format	O
(	O
.lrz	O
)	O
is	O
incompatible	O
with	O
rzip	B-Application
's	O
.	O
</s>
<s>
The	O
lrzip	O
distribution	O
comes	O
with	O
a	O
pair	O
of	O
programs	O
to	O
use	O
it	O
with	O
tar	B-Application
,	O
lrztar	O
and	O
lrzuntar	O
.	O
</s>
<s>
rzip64	O
is	O
an	O
extension	O
of	O
rzip	B-Application
for	O
very	O
large	O
files	O
that	O
can	O
utilize	O
multiple	O
CPU	B-Architecture
cores	I-Architecture
in	O
parallel	O
.	O
</s>
<s>
The	O
file	O
format	O
of	O
rzip64	O
is	O
identical	O
to	O
the	O
original	O
rzip	B-Application
.	O
</s>
<s>
REP	O
is	O
an	O
alternative	O
implementation	O
of	O
rzip	B-Application
algorithm	O
by	O
Bulat	O
Ziganshin	O
used	O
in	O
his	O
FreeArc	B-Application
archiver	O
as	O
preprocessor	O
for	O
LZMA/Tornado	O
compression	B-General_Concept
algorithms	I-General_Concept
.	O
</s>
<s>
In	O
FreeArc	B-Application
,	O
REP	O
finds	O
large-distance	O
matches	O
and	O
then	O
LZMA	B-General_Concept
compress	O
the	O
remaining	O
data	O
.	O
</s>
<s>
For	O
example	O
,	O
on	O
computer	O
with	O
2GB	O
RAM	B-Architecture
,	O
REP	O
finds	O
matches	O
that	O
is	O
at	O
least	O
512	O
bytes	O
long	O
at	O
the	O
distances	O
up	O
to	O
1GB	O
,	O
and	O
then	O
LZMA	B-General_Concept
finds	O
any	O
remaining	O
matches	O
at	O
the	O
distances	O
up	O
to	O
128MB	O
.	O
</s>
<s>
So	O
,	O
working	O
together	O
,	O
they	O
provide	O
the	O
best	O
compression	O
possible	O
on	O
2GB	O
RAM	B-Architecture
budget	O
.	O
</s>
<s>
Being	O
optimized	O
for	O
stream	O
decompression	O
and	O
collaborative	O
work	O
with	O
LZMA	B-General_Concept
,	O
REP	O
has	O
some	O
differences	O
from	O
the	O
original	O
RZIP	B-Application
implementation	O
.	O
</s>
<s>
First	O
,	O
by	O
default	O
it	O
finds	O
only	O
matches	O
that	O
are	O
512+	O
byte	O
long	O
,	O
since	O
benchmarking	O
proved	O
that	O
this	O
is	O
optimal	O
setting	O
for	O
overall	O
REP+LZMA	O
compression	O
.	O
</s>
<s>
Second	O
,	O
it	O
uses	O
a	O
sliding	O
dictionary	O
that	O
's	O
about	O
1/2	O
RAM	B-Architecture
long	O
,	O
so	O
decompression	O
does	O
n't	O
need	O
to	O
reread	O
data	O
from	O
decompressed	O
file	O
.	O
</s>
<s>
Larger	O
minimal	O
match	O
length	O
(	O
512	O
bytes	O
compared	O
to	O
32	O
bytes	O
in	O
rzip	B-Application
)	O
allowed	O
for	O
additional	O
speed	O
optimizations	O
,	O
so	O
that	O
REP	O
provides	O
very	O
fast	O
compression	O
(	O
about	O
200MB/s	O
on	O
Intel	O
i3-2100	O
)	O
.	O
</s>
<s>
SREP	O
(	O
SuperREP	O
)	O
is	O
an	O
implementation	O
of	O
Tridgell	O
's	O
idea	O
of	O
LZ	O
compressor	O
that	O
does	O
n't	O
store	O
its	O
dictionary	O
in	O
RAM	B-Architecture
,	O
using	O
instead	O
SHA1	O
hashes	O
of	O
processed	O
blocks	O
to	O
compare	O
their	O
contents	O
.	O
</s>
<s>
It	O
allows	O
the	O
program	O
to	O
compress	O
files	O
that	O
are	O
about	O
10x	O
larger	O
than	O
RAM	B-Architecture
available	O
.	O
</s>
<s>
Decompression	O
performed	O
either	O
by	O
reading	O
data	O
from	O
decompressed	O
part	O
of	O
file	O
,	O
or	O
by	O
storing	O
in	O
the	O
memory	O
future	O
matches	O
(	O
future-LZ	O
compression	B-General_Concept
algorithm	I-General_Concept
)	O
.	O
</s>
<s>
In	O
one	O
experiment	O
,	O
22GB	O
file	O
compressed	O
with	O
minimum	O
match	O
length	O
of	O
512	O
bytes	O
and	O
full	O
22GB	O
dictionary	O
required	O
just	O
2GB	O
of	O
RAM	B-Architecture
for	O
decompression	O
.	O
</s>
