Code Monkey home page Code Monkey logo

jda.cr's Introduction

Table of Contents

Scope

This library is aimed to parse and extract data from CSV JDA files basing on the specified filters.

Usage

Compile the program and use form command line:

crystal compile --release src/jda.cr

Print the help manual:

./jda -h

Examples

Filter feeds into the /jda folder by markdown price, stores and specified SKUs:

./jda --src=/jda --markdown --stores=20102,25099,23277,21400 --skus=806932926,807264831

Benchmarks

I benchmarked the JDA Crystal version against a specific branch of the Ruby one: the reason is that Crystal currently dos not include a library to deal with TAR archives, so i decided to parse plain TXT files.

Platform

I registered these benchmarks with a MacBook PRO 15 late 2011 having these specs:

  • OSX El Captain
  • 2,2 GHz Intel Core i7 (4 cores)
  • 8 GB 1333 MHz DDR3

Workload

I stressed the libraries by applying the markdown filter to four CSV with the following features:

Name Weight (MB) Rows numbers
ebuskr.txt 11 49662
ebuseu.txt 42 189629
ebuspf1.txt 160 343873
ebuswh.txt 406 1845130

Records

I recorded these numbers by inspecting the RAM and CPU consumption via XCode's Instruments and by prepending each run with the time command.

Platform Execution time (real) Memory peaks (GB)
Ruby 2m31.513s 2.32
Crystal 0m20.102s 1.22

Considerations

Crystal proved to be blazing fast reading large CSV file and filtering data.
Ruby implementation relies on one process per CSV to grant parallel computation, while Crystal runs on one thread only.
Said that Crystal execution time is about one tenth of Ruby one and consumes half of the memory.

jda.cr's People

Contributors

costajob avatar

Watchers

 avatar James Cloos avatar  avatar

jda.cr's Issues

How to run benchmarks?

Hi,

I'd like to profile the app, just for fun, see if it can be further optimized. I see some benchmarks results in the readme, but how do I run them?

Thanks! ❤️

Invalid option: -o

I ran the commands in order, from the Readme. This one doesn't work:

$ ./jda -o /jda -x -t 21005,21006 -k 804511615,806732962,800907730
Invalid option: -o (OptionParser::InvalidOption)
[4498917089] main +5713

And the help doesn't seem to show an o flag:

$ ./jda --help
Usage: ./jda -s ./samples -x -k 804511615,806732962 -t 25008,25005
    -s SRC, --src=SRC                Specify feeds path (default to CWD)
    -x, --markdown                   Filter by markdown price
    -k SKUS, --skus=SKUS             Filter by specified SKUs
    -t STORES, --stores=STORES       Filter by specified store codes
    -h, --help                       Show this help

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.