Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/tc80/loseless-compression-benchmarker

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/tc80/loseless-compression-benchmarker

  • v0.0.0-20200622190333-4d3203e45307
  • Source
  • Go
  • Socket score

Version published
Created
Source

Benchmark Tool for Loseless Compression Algorithms

A simple program to generate the resulting size in bytes for a number of cdnjs files after compressing with an algorithm.

It was developed with Go version 1.14.4 and macOS Catalina 10.15.5.

Input

The application reads from input.txt, which contains the list of target cdnjs files for compression. Each entry must begin on a new line and prefixed with /ajax/libs/, corresponding to entries in the cdnjs GitHub repo.

For example: /ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.woff2

More examples can be found in this repo's input.txt.

Environment

The application relies on an environment variable CDNJS_PATH. This variable must contain the path to the local cdnjs GitHub repo after cloning.

For example: export CDNJS_PATH="/tmp/cdnjs/cdnjs"

Here, /tmp/cdnjs/cdnjs/ will contain the ajax/ directory.

Output

In order for this tool to work, the algorithm must output its result to STDOUT. This is because this tool focuses on the size of the resulting output, not writing the output itself to a file.

Build

To build, use the Makefile provided.

Simply run make to build and make clean to remove the executable/output directory.

To run the program for an algorithm with n arguments:

./compress <shell command for algorithm> <algorithm argument 1> ... <algorithm argument n>

For example, to benchmark zopfli -i1000 --gzip on all libaries in input.txt, run:

./compress zopfli -c -i1000 --gzip

Note that we added -c here to ensure the output is written to STDOUT.

Built-In Algorithms

The provided Makefile contains a number of built-in options.

  • uncompressed
  • zopfli
    • gzip
    • zlib
    • deflate
  • brotli
    • q5
    • q11
  • gzip
    • 5
    • 9

To run all of them at once:

make run

This will generate a number of csv files in the output/ directory.

FAQs

Package last updated on 22 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc