sportdb / sport.db

sport.db - open sports database (e.g. football.db, formula1.db etc.) command line tool and libraries
Creative Commons Zero v1.0 Universal
221 stars 29 forks source link

Use String#gsub with a Hash as the replacement #8

Closed rab closed 5 years ago

rab commented 5 years ago

You missed that gsub can take a Hash as its second argument.

                           user     system      total        real
each_char              1.580000   0.020000   1.600000 (  1.633651)
each_char_v2           1.350000   0.010000   1.360000 (  1.413720)
each_char_reduce       1.770000   0.020000   1.790000 (  1.846817)
each_char_reduce_v2    1.500000   0.020000   1.520000 (  1.549961)
gsub                   1.380000   0.010000   1.390000 (  1.422130)
gsub_v2                1.150000   0.010000   1.160000 (  1.181604)
gsub_v3                0.960000   0.020000   0.980000 (  1.001596)
scan                   2.360000   0.020000   2.380000 (  2.436495)
geraldb commented 5 years ago

Today I learned. Wow. Thanks. Cheers. Prost.