In t1 timeit Timer re search mac import re re re compile 0-9a-fA-F mac

1
2
3
4
5
6
In [7]: t1 = timeit.Timer("re.search(mac)", "import re;re = re.compile(r'^([0-9a-fA-F]{2}([:-]|$)){6}$'); mac = 'aa:bB:Cc:DD:e4:11'")
In [8]: t2 = timeit.Timer("re.search(mac)", "import re;re = re.compile(r'^([0-9a-f]{2}([:-]|$)){6}$',re.I); mac = 'aa:bB:Cc:DD:e4:11'")
In [11]: t1.timeit(1000000)
Out[11]: 1.8474640846252441
In [12]: t2.timeit(1000000)
Out[12]: 2.3825578689575195