Application VERY slow when profiling
ethan strauss
Posts: 3
Hi,
I am using Profiler 2.7.1.20 and I find that it slows down my application tremendously when I am profiling. I make a lot of use of Regular Expressions and I find that, in some instances at least, profiler slows them down so much that it is effectively unusable. I write code in C#.Net 1.1.
I have one web page which takes ~30 seconds to load normally. I wanted to profile it and see what was taking so long, so I started up profiler and tried to load the page. I gave up loading after a half hour. I did take a snapshot before turning off profiler and it pointed to a single line Regular Expression which was the problem. I have since changed that code to not use the regular expression and the page now loads in about second, so it got that right. The regular expression is below...
Is there a problem with Profiler and Regex? I would like to be able to use it to evaluate Regular Expressions in a reasonable fashion.
Thanks,
Ethan
This is the expression which I was using.
Regex SgfPmeBackboneRegex = new Regex("(?<upstream>[GATC]*GCGAT)CGC[GATC]*GTTT(?<Downstream>AAAC[GATC]*)");
and here is the line in which it was used. This was called ~100 times per page load.
Match BackBoneBits = SgfPmeBackboneRegex.Match(backboneInfo.NucleotideSequence.Sequence);
backboneInfo.NucleotideSequence.Sequence is ~3000-6000 characters long
I am using Profiler 2.7.1.20 and I find that it slows down my application tremendously when I am profiling. I make a lot of use of Regular Expressions and I find that, in some instances at least, profiler slows them down so much that it is effectively unusable. I write code in C#.Net 1.1.
I have one web page which takes ~30 seconds to load normally. I wanted to profile it and see what was taking so long, so I started up profiler and tried to load the page. I gave up loading after a half hour. I did take a snapshot before turning off profiler and it pointed to a single line Regular Expression which was the problem. I have since changed that code to not use the regular expression and the page now loads in about second, so it got that right. The regular expression is below...
Is there a problem with Profiler and Regex? I would like to be able to use it to evaluate Regular Expressions in a reasonable fashion.
Thanks,
Ethan
This is the expression which I was using.
Regex SgfPmeBackboneRegex = new Regex("(?<upstream>[GATC]*GCGAT)CGC[GATC]*GTTT(?<Downstream>AAAC[GATC]*)");
and here is the line in which it was used. This was called ~100 times per page load.
Match BackBoneBits = SgfPmeBackboneRegex.Match(backboneInfo.NucleotideSequence.Sequence);
backboneInfo.NucleotideSequence.Sequence is ~3000-6000 characters long
Ethan Strauss Ph.D.
Bioinformatics Scientist
Promega Corporation
2800 Woods Hollow Rd.
Madison, WI 53711
608-274-4330
800-356-9526
ethan.strauss@promega.com
Bioinformatics Scientist
Promega Corporation
2800 Woods Hollow Rd.
Madison, WI 53711
608-274-4330
800-356-9526
ethan.strauss@promega.com
Comments
I can't find a whole lot of information about the inner workings of regular expressions in .NET, but I'd imagine that when ANTS Profiler 2.x disables code inlining, this could be to blame.
Profiler 3 can (sometimes) allow inlining, have you evaluated the new version?
I have not tried profiler 3. I will see if I can give it a try soon and let you know.
Ethan
Bioinformatics Scientist
Promega Corporation
2800 Woods Hollow Rd.
Madison, WI 53711
608-274-4330
800-356-9526
ethan.strauss@promega.com