Skip to content

Instantly share code, notes, and snippets.

@headius
Created October 26, 2012 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headius/3960364 to your computer and use it in GitHub Desktop.
Save headius/3960364 to your computer and use it in GitHub Desktop.
exception-based versus stat-based dir entries, GC comparison
system ~/projects/jruby $ ruby-1.9.3 stat.rb
=== warming up ===
********* dirs + exception
0.614566
GC count: 34
0.61096
GC count: 34
0.606194
GC count: 34
0.605782
GC count: 34
0.607302
GC count: 34
********* nodirs + exception
0.455176
GC count: 47
0.454934
GC count: 47
0.461721
GC count: 47
0.456139
GC count: 47
0.453682
GC count: 47
********* dirs + stat
0.71154
GC count: 34
0.690492
GC count: 34
0.688012
GC count: 34
0.691404
GC count: 34
0.688759
GC count: 34
********* nodirs + stat
0.045703
GC count: 0
0.046001
GC count: 1
0.044948
GC count: 0
0.046368
GC count: 1
0.04521
GC count: 0
system ~/projects/jruby $ jruby stat.rb
=== warming up ===
********* dirs + exception
2.421
GC count: 4
1.365
GC count: 1
1.279
GC count: 2
1.281
GC count: 1
1.311
GC count: 2
********* nodirs + exception
3.403
GC count: 4
2.817
GC count: 5
2.829
GC count: 7
2.844
GC count: 9
2.836
GC count: 14
********* dirs + stat
1.564
GC count: 8
1.523
GC count: 11
1.524
GC count: 14
1.528
GC count: 15
1.529
GC count: 15
********* nodirs + stat
0.109
GC count: 1
0.108
GC count: 1
0.109
GC count: 1
0.107
GC count: 1
0.108
GC count: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment