Hi, could I know if it's faster using hexadecimal values instead of
charsm in Ruby?
I mean:
a) char =~ /[\x61-\x7A]|[\x41-\x5A]/
b) char =~ /[A-Z]|[a-z]/
Both are the same, but maybe a) operation is faster than b) ?
Thanks a lot.
···
--
Iñaki Baz Castillo
<ibc@aliax.net>
Sorry, I've found Benchmark Class and have tried it:
Benchmark.realtime {'f' =~ /[\x61-\x7A]|[\x41-\x5A]/ }
=> 1.81198120117188e-05
Benchmark.realtime {'f' =~ /[A-Z]|[a-z]/ }
=> 1.81198120117188e-05
both give similar results.
Best regards.
···
2008/4/15, Iñaki Baz Castillo <ibc@aliax.net>:
Hi, could I know if it's faster using hexadecimal values instead of
charsm in Ruby?
I mean:
a) char =~ /[\x61-\x7A]|[\x41-\x5A]/
b) char =~ /[A-Z]|[a-z]/
Both are the same, but maybe a) operation is faster than b) ?
--
Iñaki Baz Castillo
<ibc@aliax.net>