You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Michael Schall (JIRA)" <ib...@incubator.apache.org> on 2008/06/05 21:49:46 UTC
[jira] Created: (IBATISNET-270) ParseGenericArguments IsMatch is
very slow
ParseGenericArguments IsMatch is very slow
------------------------------------------
Key: IBATISNET-270
URL: https://issues.apache.org/jira/browse/IBATISNET-270
Project: iBatis for .NET
Issue Type: Improvement
Components: DataMapper
Affects Versions: DataMapper 1.6.1
Reporter: Michael Schall
I knew .* is expensive in regular expressions, but I had no idea how expensive! In our application when ConfigureAndWatch is called, the IsMatch function call within ParseGenericArguments is taking 5000ms (reported by dotTrace). The method is called 1005 times at 5ms a piece. By simply removing the .* from the beginning of the regular expression, the time is brought down to a total of 4ms (not per call, total)! I also made the RegEx object a static of the class so we aren't re-creating the expression for each call to bring the total time down to 2ms! I'll attach 2 images of the before and after traces if I can.
Please check my work... I have tested it with my app and everything works fine.
Mike
I will include the patch here:
private readonly static Regex _generic = new Regex(@"`\d*\[\[", RegexOptions.Compiled);
private void ParseGenericArguments(string originalString)
{
// Check for match
bool isMatch = _generic.IsMatch(originalString);
if (!isMatch)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (IBATISNET-270) ParseGenericArguments IsMatch is
very slow
Posted by "Gilles Bayon (JIRA)" <ib...@incubator.apache.org>.
[ https://issues.apache.org/jira/browse/IBATISNET-270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gilles Bayon closed IBATISNET-270.
----------------------------------
Resolution: Fixed
Fix Version/s: DataMapper 1.6.2
Assignee: Gilles Bayon
Thanks,
Corrected also in version 3.0
In SVN
> ParseGenericArguments IsMatch is very slow
> ------------------------------------------
>
> Key: IBATISNET-270
> URL: https://issues.apache.org/jira/browse/IBATISNET-270
> Project: iBatis for .NET
> Issue Type: Improvement
> Components: DataMapper
> Affects Versions: DataMapper 1.6.1
> Reporter: Michael Schall
> Assignee: Gilles Bayon
> Fix For: DataMapper 1.6.2
>
> Attachments: After change.jpg, Before change.jpg
>
>
> I knew .* is expensive in regular expressions, but I had no idea how expensive! In our application when ConfigureAndWatch is called, the IsMatch function call within ParseGenericArguments is taking 5000ms (reported by dotTrace). The method is called 1005 times at 5ms a piece. By simply removing the .* from the beginning of the regular expression, the time is brought down to a total of 4ms (not per call, total)! I also made the RegEx object a static of the class so we aren't re-creating the expression for each call to bring the total time down to 2ms! I'll attach 2 images of the before and after traces if I can.
> Please check my work... I have tested it with my app and everything works fine.
> Mike
> I will include the patch here:
> private readonly static Regex _generic = new Regex(@"`\d*\[\[", RegexOptions.Compiled);
> private void ParseGenericArguments(string originalString)
> {
> // Check for match
> bool isMatch = _generic.IsMatch(originalString);
> if (!isMatch)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.