Giter VIP home page Giter VIP logo

lolcat's Introduction

What?

Screenshot

Installation

Archlinux

There's an AUR package:

$ yaourt -S c-lolcat

Ubuntu (Snap)

See this awesome blog post by a kind person from the internet:

$ snap install lolcat-c

Mac

Build the system-libc version (instead of the statically linked version) with:

$ make lolcat

...and put the resulting binary at a place of your choice.

Others

$ make && sudo make install

If this can't find musl and you have it installed somewhere, run

$ make MUSLDIR=/path/to/musl

If you don't have a musl around yet, the easiest way to build is to run

$ git submodule init
$ git submodule update
$ make

This will checkout and build musl in this repository's musl dir.

Why?

This lolcat clone is an attempt to reduce the world's carbon dioxide emissions by optimizing inefficient code. It's >10x as fast and <0.1% as large as the original one.

newton~/d/lolcat <3 dmesg>foo
newton~/d/lolcat <3 time upstream/bin/lolcat foo
13.51user 1.34system 0:15.99elapsed 92%CPU (0avgtext+0avgdata 10864maxresident)k
0inputs+0outputs (0major+1716minor)pagefaults 0swaps
newton~/d/lolcat <3 time ./lolcat foo
0.02user 0.00system 0:00.09elapsed 34%CPU (0avgtext+0avgdata 1936maxresident)k
0inputs+0outputs (0major+117minor)pagefaults 0swaps

Bonus comparison with python-lolcat:

newton~/d/lolcat <3 dmesg>foo
$ time python-lolcat foo
12.27user 0.00system 0:12.29elapsed 99%CPU (0avgtext+0avgdata 11484maxresident)k
0inputs+0outputs (0major+1627minor)pagefaults 0swaps
$ time c-lolcat foo
0.29user 0.00system 0:00.30elapsed 98%CPU (0avgtext+0avgdata 468maxresident)k
0inputs+0outputs (0major+21minor)pagefaults 0swaps

(Read: c-lolcat << python-lolcat << ruby-lolcat)

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.