j...@hedy:~$ time perl -E '@a=map {qq(hello$_)} (1 .. 1000); /hello1000/ ~~
@a for 1..100000'
real 0m7.226s
user 0m7.124s
sys 0m0.020s
j...@hedy:~$ time perl -E '@a=map {qq(hello$_)} (1 .. 1000); /hello999/ ~~ @a
for 1..100000'
real 0m17.825s
user 0m16.297s
sys 0m0.052s
一个有趣的对比,模式稍微改变一下就能导致正则的性能有一倍的差异。也不知道是正则的问题还是 smart matching 的问题。
2009/2/20 Michael Zeng <[email protected]>
> 这样的
>
>
> On 2/20/09, agentzh <[email protected]> wrote:
>>
>> 2009/2/19 Michael Zeng <[email protected]>
>>
>>>
>>> 这个是什么原因?优化的regexp engine,重新用C写过了?
>>>
>>>
>>
>> 正则引擎几乎整个重写过了,详情见 perldelta,呵呵。感谢 dmq++,这位"regex man"的工作,哈哈!
>>
>>
>> Cheers,
>> -agentzh
>>
>> >>
>>
--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛“PerlChina Mongers 讨论组”论坛。
要在此论坛发帖,请发电子邮件到 [email protected]
要退订此论坛,请发邮件至 [email protected]
更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛
-~----------~----~----~----~------~----~------~--~---