Giter Club home page Giter Club logo

binary_parser_comparison's Introduction

Python Binary Parsing Tester

This repository contains a series of simple scripts for testing three different methods of parsing binary files in Python. The goal of this project was to compare speeds of two libraries for parsing binary files (Kaitai and Construct) as well as a pure Python method.

Prerequisites

This project was deveeloped in Python 3.6.9. Please refer to requirements.txt for package information.

Usage

See below for information on generating test data and parsing.

###Generating Test Data

After cloning the repository, you should run the script test_data_generator.py in order to create binary files for parsing testing. Modify the following lines to change file sizes:

# desired file sizes
file_size_small = 100*1024 # 100 kib
file_size_medium = 100*1024**2 # 100 mib
file_size_big = 1024**3 # 1 gib

Testing Parsing

To test parsing, run the script test_suite.py. Currently the largest file size is skipped, this can be modified in the followign lines of code my modifying the list after "for file_size in":

# benchmark how long it takes to parse each file in various parsing types
    for parse_type in ["construct",  "kaitai", "homebrew"]:
        for file_type in [data_simple_fn, data_varying_fn, data_complex_fn]:
            for file_size in [small_f, med_f]: #[small_f, med_f, big_f]:

Modifying Structure

If desired, the structure of generated files can be easily modified by changing the format definitions in construct_format_defs.py. Note that parsers will have to be updated accordingly. Please refer to Kaitai documentation as well as Construct documentation for more information on that.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

binary_parser_comparison's People

Contributors

haydenridd avatar

Stargazers

 avatar

Watchers

 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.