Skip to content

Instantly share code, notes, and snippets.

@felixbuenemann
Created January 21, 2016 00:33
Show Gist options
  • Save felixbuenemann/b3d8762337d50a49d943 to your computer and use it in GitHub Desktop.
Save felixbuenemann/b3d8762337d50a49d943 to your computer and use it in GitHub Desktop.

Ruby VIPS Benchmark with different GC strategies

ruby:

ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin15]

test:

/usr/bin/time -l bundle exec ./memusage.rb earth<res>.jpg

earth10k.jpg – 100 iterations

no gc:

RSS at startup with gems loaded: 32 MB
Iteration: 100      RSS:   4686 MB File: earth10k.jpg
RSS at exit: 1672 MB
       68.01 real       112.38 user         7.42 sys
4915789824  maximum resident set size

minor gc lazy sweep every 10 writes:

RSS at startup with gems loaded: 32 MB
Iteration: 100      RSS:    940 MB File: earth10k.jpg
RSS at exit: 810 MB
       65.73 real       109.98 user         6.32 sys
1246281728  maximum resident set size

minor gc immediate sweep every 10 writes:

RSS at startup with gems loaded: 31 MB
Iteration: 100      RSS:    763 MB File: earth10k.jpg
RSS at exit: 694 MB
       65.93 real       110.46 user         6.22 sys
1084141568  maximum resident set size

major gc immediate sweep every 100 writes:

RSS at startup with gems loaded: 31 MB
Iteration: 100      RSS:   4687 MB File: earth10k.jpg
RSS at exit: 1671 MB
       66.83 real       110.31 user         7.21 sys
4914827264  maximum resident set size

major gc immediate sweep:

RSS at startup with gems loaded: 32 MB
Iteration: 100      RSS:    180 MB File: earth10k.jpg
RSS at exit: 143 MB
       66.99 real       112.57 user         6.22 sys
 189104128  maximum resident set size

major gc lazy sweep:

RSS at startup with gems loaded: 32 MB
Iteration: 100      RSS:    189 MB File: earth10k.jpg
RSS at exit: 153 MB
       66.42 real       111.38 user         6.09 sys
 199024640  maximum resident set size

minor gc immediate sweep:

RSS at startup with gems loaded: 32 MB
Iteration: 100      RSS:    180 MB File: earth10k.jpg
RSS at exit: 144 MB
       65.45 real       110.28 user         5.96 sys
 189554688  maximum resident set size

minor gc lazy sweep:

RSS at startup with gems loaded: 32 MB
Iteration: 100      RSS:    190 MB File: earth10k.jpg
RSS at exit: 153 MB
       66.43 real       111.67 user         6.08 sys
 199331840  maximum resident set size

earth1k.jpg - 1,000 iterations

no gc:

RSS at startup with gems loaded: 32 MB
Iteration: 1000     RSS:   4915 MB File: earth1k.jpg
RSS at exit: 4916 MB
       23.52 real        20.18 user        11.98 sys
5155545088  maximum resident set size

minor gc lazy sweep every 10 writes:

RSS at startup with gems loaded: 32 MB
Iteration: 1000     RSS:    204 MB File: earth1k.jpg
RSS at exit: 204 MB
       19.97 real        20.15 user         8.99 sys
 214970368  maximum resident set size

minor gc immediate sweep every 10 writes:

RSS at startup with gems loaded: 32 MB
Iteration: 1000     RSS:    148 MB File: earth1k.jpg
RSS at exit: 148 MB
       19.74 real        20.16 user         8.64 sys
 155787264  maximum resident set size

major gc immediate sweep every 100 writes:

RSS at startup with gems loaded: 32 MB
Iteration: 1000     RSS:   1084 MB File: earth1k.jpg
RSS at exit: 1084 MB
       22.63 real        20.44 user        11.44 sys
1137135616  maximum resident set size

major gc immediate sweep:

RSS at startup with gems loaded: 32 MB
Iteration: 1000     RSS:     53 MB File: earth1k.jpg
RSS at exit: 53 MB
       25.74 real        25.67 user         8.84 sys
  56455168  maximum resident set size

major gc lazy sweep:

RSS at startup with gems loaded: 32 MB
Iteration: 1000     RSS:     54 MB File: earth1k.jpg
RSS at exit: 54 MB
       25.57 real        25.38 user         8.82 sys
  57049088  maximum resident set size

minor gc immediate sweep:

RSS at startup with gems loaded: 32 MB
Iteration: 1000     RSS:     54 MB File: earth1k.jpg
RSS at exit: 54 MB
       19.91 real        20.52 user         8.22 sys
  56832000  maximum resident set size

minor gc lazy sweep:

RSS at startup with gems loaded: 32 MB
Iteration: 1000     RSS:     55 MB File: earth1k.jpg
RSS at exit: 55 MB
       20.29 real        20.87 user         8.34 sys
  58515456  maximum resident set size

earth128.jpg - 10,000 iterations

no gc:

RSS at startup with gems loaded: 32 MB
Iteration: 10000    RSS:    670 MB File: earth128.jpg
RSS at exit: 671 MB
       99.20 real        43.56 user        65.69 sys
 703938560  maximum resident set size

minor gc lazy sweep every 10 writes:

RSS at startup with gems loaded: 32 MB
Iteration: 10000    RSS:     39 MB File: earth128.jpg
RSS at exit: 39 MB
       70.27 real        38.95 user        39.91 sys
  41295872  maximum resident set size

minor gc immediate sweep every 10 writes:

RSS at startup with gems loaded: 32 MB
Iteration: 10000    RSS:     39 MB File: earth128.jpg
RSS at exit: 39 MB
       71.86 real        39.44 user        41.29 sys
  41177088  maximum resident set size

major gc immediate sweep every 100 writes:

RSS at startup with gems loaded: 32 MB
Iteration: 10000    RSS:     96 MB File: earth128.jpg
RSS at exit: 96 MB
       74.33 real        39.80 user        43.44 sys
 101588992  maximum resident set size

major gc immediate sweep:

RSS at startup with gems loaded: 32 MB
Iteration: 10000    RSS:     34 MB File: earth128.jpg
RSS at exit: 34 MB
      131.87 real        90.77 user        48.74 sys
  36126720  maximum resident set size

major gc lazy sweep:

RSS at startup with gems loaded: 32 MB
Iteration: 10000    RSS:     33 MB File: earth128.jpg
RSS at exit: 33 MB
      131.23 real        89.95 user        48.81 sys
  35680256  maximum resident set size

minor gc immediate sweep:

RSS at startup with gems loaded: 32 MB
Iteration: 10000    RSS:     33 MB File: earth128.jpg
RSS at exit: 33 MB
       80.60 real        45.82 user        42.73 sys
  35409920  maximum resident set size

minor gc lazy sweep:

RSS at startup with gems loaded: 32 MB
Iteration: 10000    RSS:     34 MB File: earth128.jpg
RSS at exit: 34 MB
       82.32 real        46.03 user        44.67 sys
  36024320  maximum resident set size
@felixbuenemann
Copy link
Author

image sizes:

earth10k.jpg JPEG 10000x10000 10000x10000+0+0 8-bit sRGB 9.407MB 0.000u 0:00.000
earth1k.jpg JPEG 1024x1024 1024x1024+0+0 8-bit sRGB 147KB 0.000u 0:00.000
earth128.jpg JPEG 128x128 128x128+0+0 8-bit sRGB 3.76KB 0.000u 0:00.000

Source Image: North_Africa_and_Europe_from_Suomi_NPP_-_NASA_Earth_Observatory.jpg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment