ianks / mini_phone

A fast phone number parser, validator and formatter for Ruby. This gem binds to Google's C++ libphonenumber for spec-compliance and performance.
MIT License
158 stars 7 forks source link

Comparison with mobi/telephone_number? #4

Closed joelmoss closed 3 years ago

joelmoss commented 3 years ago

Nice performance comparison with https://github.com/daddyz/phonelib, but how does MiniPhone compare with https://github.com/mobi/telephone_number?

ianks commented 3 years ago

Very good question, and I am not sure. I’ll add a benchmark for it.

ianks commented 3 years ago

Just ran the benchmarks:

Warming up --------------------------------------
   MiniPhone: valid?     3.410k i/100ms
    Phonelib: valid?    43.000  i/100ms
TelephoneNumber: valid?
                        16.000  i/100ms
Calculating -------------------------------------
   MiniPhone: valid?     33.382k (± 1.3%) i/s -    167.090k in   5.006319s
    Phonelib: valid?    422.806  (± 2.1%) i/s -      2.150k in   5.087331s
TelephoneNumber: valid?
                        164.336  (± 2.4%) i/s -    832.000  in   5.066245s

Comparison:
   MiniPhone: valid?:    33382.0 i/s
    Phonelib: valid?:      422.8 i/s - 78.95x  (± 0.00) slower
TelephoneNumber: valid?:      164.3 i/s - 203.13x  (± 0.00) slower

Warming up --------------------------------------
     MiniPhone: e164     4.058k i/100ms
      Phonelib: e164    57.000  i/100ms
TelephoneNumber: e164
                        23.000  i/100ms
Calculating -------------------------------------
     MiniPhone: e164     41.188k (± 2.1%) i/s -    206.958k in   5.027078s
      Phonelib: e164    578.993  (± 2.6%) i/s -      2.907k in   5.024087s
TelephoneNumber: e164
                        228.837  (± 3.1%) i/s -      1.150k in   5.030650s

Comparison:
     MiniPhone: e164:    41187.5 i/s
      Phonelib: e164:      579.0 i/s - 71.14x  (± 0.00) slower
TelephoneNumber: e164:      228.8 i/s - 179.99x  (± 0.00) slower
ianks commented 3 years ago

Updated the readme as well :smile: