nucliweb
11/24/2014 - 4:11 PM

css-preprocessor-benchmark.sh

Sass:

real	0m4.945s
user	0m4.729s
sys	0m0.219s
Sass with warm cache:

real	0m2.491s
user	0m2.399s
sys	0m0.092s
SassC (libsass):

real	0m0.209s
user	0m0.193s
sys	0m0.016s
Stylus:

real	0m1.662s
user	0m1.519s
sys	0m0.160s
LESS:

real	0m0.488s
user	0m0.375s
sys	0m0.117s
r.js

real	0m0.155s
user	0m0.115s
sys	0m0.041s
Rework:

real	0m0.218s
user	0m0.209s
sys	0m0.008s
#!/bin/bash

mkdir tmp.$$

for i in {0..9999}; do
  echo ".x$i{color:green;}"
done > tmp.$$/main.scss

rm -rf .sass-cache
echo Sass:
time ~/src/sass/bin/sass tmp.$$/main.scss > /dev/null
echo Sass with warm cache:
time ~/src/sass/bin/sass tmp.$$/main.scss > /dev/null
echo 'SassC (libsass):'
time ~/src/sassc/bin/sassc < tmp.$$/main.scss > /dev/null
echo Stylus:
time ~/src/stylus/bin/stylus < tmp.$$/main.scss > /dev/null
echo LESS:
time ~/src/less.js/bin/lessc - < tmp.$$/main.scss > /dev/null
echo r.js
time node ~/src/r.js/dist/r.js -o cssIn=tmp.$$/main.scss out=/dev/null > /dev/null
echo Rework:
(
  set -e
  cd tmp.$$
  echo '{}' > package.json
  npm link rework > /dev/null
  time node -e "require('rework')(require('fs').readFileSync('main.scss', {encoding: 'utf-8'})) + ''"
)

rm -r tmp.$$
rm -rf .sass-cache