For simple example it is simple understandable that rule

RewriteRule ^([a-z]{2,8})$ ?id=$1 [L,QSA]

is faster than

RewriteRule ^(.*)$ ?id=$1 [L,QSA]

But can there be in whatever way to check on and compare its (Apache RewriteRule regex) correct performance?

Apache regex seams to become derived from PCRE so that you can most likely use pcretest to benchmark and obtain an idea the way they perform.

Listed here are the outcomes when timing the 2 expressions using a million test matches and three different test inputs. Outputting is average execution time for every match.

$ pcretest -tm 1000000 -q
  re> /^([a-z]{2,8})$/
data> a
Execute time 0.0002 milliseconds
No match
data> aaaaaaaa
Execute time 0.0003 milliseconds
 0: aaaaaaaa
 1: aaaaaaaa
data> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Execute time 0.0006 milliseconds
No match
data> 

$ pcretest -tm 1000000 -q
  re> /^(.*)$/
data> a
Execute time 0.0003 milliseconds
 0: a
 1: a
data> aaaaaaaa
Execute time 0.0003 milliseconds
 0: aaaaaaaa
 1: aaaaaaaa
data> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Execute time 0.0005 milliseconds
 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
data> 

They seam to possess similar execution occasions, around 2-3 million matches per second on my small test machine. However the real questions is, so why do you think the matching time for he rewrite rules really are a problem?