summaryrefslogtreecommitdiff
path: root/README.md
blob: f7a6695048e3e9471adc22f64fe8b8adcddd184d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# What?

![](https://raw.githubusercontent.com/jaseg/lolcat/master/LOLCat-Rainbow.jpg)

## Screenshot

![](https://raw.githubusercontent.com/jaseg/lolcat/master/screenshot.png)

![](./sl.gif)

## Installation

### Archlinux

There's an [AUR package](https://aur.archlinux.org/packages/c-lolcat):

```bash
$ yaourt -S c-lolcat
```

### Others

```bash
$ make && sudo make install
```

If this can't find musl and you have it installed somewhere, run
```bash
$ make MUSLDIR=/path/to/musl
```

If you don't have a musl around yet, the easiest way to build is to run
```bash
$ 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.

```bash
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](https://github.com/tehmaze/lolcat/):
```bash
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```)