A weird performance issue about regExp!

View: New views
1 Messages — Rating Filter:   Alert me  

A weird performance issue about regExp!

by ha a :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The further clue about the previous topic: "A weird performance issue"
After some investigation, maybe regExp is one of the reasons.

One loop in my air program:

    var beg1:Date = new Date();
    regexMatched = regexpArray[index].test(line);
    var end1:Date = new Date();
    sum1 += (end1.valueOf()-beg1.valueOf());

Then for value of sum1:
The 1st run--------The 2nd run--------The 3rd run
34   --->          154      --->      34               
39   --->          141      --->      39
54   --->          200      --->      59

Why so great difference for the second run regExp.test()?

Any comments?

Thanks.


--- 09年11月3日,周二, ha a <ahatest@...> 写道:

发件人: ha a <ahatest@...>
主题: Weird performance issue
收件人: flexcoders@...
日期: 2009年11月3日,周二,下午1:35

An air program will process many log files,
click run button to inspect these log files one by one.

*Problems*:
Click run button, then the air program's performance is OK.
Click run button again, then the air program's performance maybe OK or may not OK.(about 60-70% is NOT OK)
Click run button again, then the air program's performance is OK.
.... ...

Then, seems only the second run may have the performance issue.
So weird?
In fact, each run should do the same thing.
BTW, the busy cursor is a clock, when running slow, the clock cursor also run slowly.

*About profiler*:
And I also use Flex builder profiler to analyse.
For example,
for OK run,
elapse time: 2min
the biggest cumulative time: 1min

for issue run:
elapse time: 7min
the biggest cumulative time: 3.5min


*Questions*:
1.
 Do you have any general clue or hint on this issue?
2. About profiler, for example, the elapse time is 7min, but cumulative time is 3.5min, where is another 3.5min?
seems some functions were not be counted by profiler?
how can I know what costs the another 3.5 min?


*Backgrounds*:
1. Windows Vista, Flex builder3, flex sdk3.2, actionscript3
2. when processing log, read file, check each line for finding the keyword.
3. one virtual thread(by timer) is for one log file processing.
4: any other information need?

Thanks





        好玩贺卡等你发,邮箱贺卡全新上线!


      ___________________________________________________________
  好玩贺卡等你发,邮箱贺卡全新上线!
http://card.mail.cn.yahoo.com/