Code Monkey home page Code Monkey logo

fzcat's Introduction

fzcat

Fast zcat with mmap and miniz

I coincidentally noticed that using mmap, miniz, and C++11 threads together I can zcat multiple files faster than pigz so I decided to release the code separately for those who may benefit from it.

How is it faster

First, miniz is a blazing fast implementation of zlib. Second, instead of using open and read we use mmap and pipe that directly into miniz. Then we take the output written to a buffer and write it directly to stdout. This reduces the number of times the memory is copied around, increasing the performance.

How fast is it

Running against 189 files of about 20MB each

Warming up by catting all files to /dev/null
zcat 107.95278143882751
parallel_zcat 42.61844491958618
pigz 55.39036321640015
parallel_pigz 42.56399941444397
fzcat 28.799103498458862
Running again but dropping cache between runs
zcat 109.37209343910217
parallel_zcat 43.26405954360962
pigz 58.75359654426575
parallel_pigz 43.09493350982666
fzcat 31.75873327255249

When is it not faster

When decompressing a single file. In that instance, my per-file threading doesn’t apply and pigz wins

Compiling

You will need a C++ compiler that support C++14. I’d highly recommend the latest version of Clang.

premake4 gmake
make config=static

Usage

fzcat [<file1> [<file2> [<file3>...] ] ]

fzcat's People

Contributors

tomalexander avatar

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.