Huanian-Vector-Li wrote:
> Hi Steve and team,
> 
> I have checked CStyle.py and used profile module to get the time 
> bottleneck, which seems it is re.search()/re.match().
> Pls see attached file (getbottleneck.log) to get the detail.
> 
> Also, I investigated the ctyle.pl and the implement of regular 
> expression(RE for short) in perl.
> RE is implemented via C in perl while it is implemented in re.py in python.
> So, it seems reasonable that the performance of CStyle.py is lower than 
> ctyle.pl.
> At least I think the performance of perl's RE is higher than python RE 
> module.
> 
> Last, I have two questions here,
> 1. What the acceptable performance of CStyle.py in comparison with 
> cstyle.pl?

Ideally, we would like for CStyle.py to be at least on par with cstyle.pl

> 2. Any other possible bottleneck of CStyle.py?
> Please add your suggestion/comments, thanks!

When I ported CStyle.py, I basically did a one-to-one port of the old 
Perl logic (in order to achieve correctness in a minimal amount of time) 
- so I believe we could achieve some performance gains by properly 
refactoring it a bit as more of a proper Python program.

Can we eliminate the use of RE's in some places in favour of more 
standard string.* methods?

cheers,
steve
-- 
stephen lau // stevel at sun.com | 650.786.0845 | http://whacked.net
opensolaris // solaris kernel development

Reply via email to