Skip to content

Instantly share code, notes, and snippets.

@tomdalling
Created June 13, 2017 00:07
Show Gist options
  • Save tomdalling/75de57a952f807bcb76c00762977694f to your computer and use it in GitHub Desktop.
Save tomdalling/75de57a952f807bcb76c00762977694f to your computer and use it in GitHub Desktop.
Benchmarking input validation
Using Ruby 2.4.1
Code being benchmarked: https://github.com/tomdalling/rschema/blob/62da91a8c6e9b4795affe6824e23f27e713a1214/benchmarks/input_validation.rb
Warming up --------------------------------------
RSchema 3.1.1 1.640k i/100ms
(coerced) 673.000 i/100ms
(built + coerced) 142.000 i/100ms
ActiveModel 5.1.1 103.000 i/100ms
dry-validation 0.10.7
759.000 i/100ms
Calculating -------------------------------------
RSchema 3.1.1 17.248k (± 5.4%) i/s - 86.920k in 5.054731s
(coerced) 6.523k (± 5.7%) i/s - 32.977k in 5.072237s
(built + coerced) 1.471k (± 5.6%) i/s - 7.384k in 5.036680s
ActiveModel 5.1.1 1.085k (± 6.5%) i/s - 5.459k in 5.055067s
dry-validation 0.10.7
7.082k (± 6.9%) i/s - 35.673k in 5.061624s
Comparison:
RSchema 3.1.1: 17248.0 i/s
dry-validation 0.10.7: 7082.0 i/s - 2.44x slower
(coerced): 6523.4 i/s - 2.64x slower
(built + coerced): 1470.7 i/s - 11.73x slower
ActiveModel 5.1.1: 1084.8 i/s - 15.90x slower
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment