Skip to content

Instantly share code, notes, and snippets.

@davydovanton
Created November 13, 2016 02:54
Show Gist options
  • Save davydovanton/40ddc298496839edc3b11c2adc0086b1 to your computer and use it in GitHub Desktop.
Save davydovanton/40ddc298496839edc3b11c2adc0086b1 to your computer and use it in GitHub Desktop.

Results

Benchmark

Before

              schema#call:   127822.5 i/s
          permissive#call:   121042.7 i/s - same-ish: difference falls within error
strict_with_defaults#call:    82149.2 i/s - 1.56x  slower
              strict#call:    73719.1 i/s - 1.73x  slower
                weak#call:    70113.8 i/s - 1.82x  slower
           symbolized#try:    63525.6 i/s - 2.01x  slower
           permissive#try:    63286.0 i/s - 2.02x  slower
          symbolized#call:    62503.9 i/s - 2.05x  slower
                 weak#try:    60762.1 i/s - 2.10x  slower
               schema#try:    58377.1 i/s - 2.19x  slower
 strict_with_defaults#try:    52421.8 i/s - 2.44x  slower
               strict#try:    50543.5 i/s - 2.53x  slower

After

          permissive#call:   158952.2 i/s
              schema#call:   158842.2 i/s - same-ish: difference falls within error
strict_with_defaults#call:   100612.8 i/s - 1.58x  slower
              strict#call:   100335.2 i/s - 1.58x  slower
                weak#call:    87223.3 i/s - 1.82x  slower
               schema#try:    84705.0 i/s - 1.88x  slower
           permissive#try:    82176.5 i/s - 1.93x  slower
                 weak#try:    79065.0 i/s - 2.01x  slower
          symbolized#call:    75370.2 i/s - 2.11x  slower
           symbolized#try:    71328.0 i/s - 2.23x  slower
               strict#try:    63523.4 i/s - 2.50x  slower
 strict_with_defaults#try:    63227.4 i/s - 2.51x  slower

Allocation

Before

Total allocated: 27488 bytes (448 objects)
Total retained:  0 bytes (0 objects)

allocated memory by gem
-----------------------------------
     27488  dry-types/lib

allocated memory by file
-----------------------------------
     14032  /Users/anton/work/repositories/dry-rb/dry-types/lib/dry/types/hash/schema.rb
     10480  /Users/anton/work/repositories/dry-rb/dry-types/lib/dry/types/definition.rb
      2976  /Users/anton/work/repositories/dry-rb/dry-types/lib/dry/types/sum.rb

After

Total allocated: 19968 bytes (260 objects)
Total retained:  0 bytes (0 objects)

allocated memory by gem
-----------------------------------
     19968  dry-types/lib

allocated memory by file
-----------------------------------
     11152  /Users/anton/work/repositories/dry-rb/dry-types/lib/dry/types/hash/schema.rb
      5840  /Users/anton/work/repositories/dry-rb/dry-types/lib/dry/types/definition.rb
      2976  /Users/anton/work/repositories/dry-rb/dry-types/lib/dry/types/sum.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment