After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 560234 - Make a regex static to improve performance
Make a regex static to improve performance
Status: RESOLVED FIXED
Product: banshee
Classification: Other
Component: general
git master
Other Linux
: Normal normal
: 1.6
Assigned To: Banshee Maintainers
Banshee Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-11-10 21:41 UTC by Bertrand Lorentz
Modified: 2009-01-21 20:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Make the regex a static field (901 bytes, patch)
2008-11-10 21:42 UTC, Bertrand Lorentz
committed Details | Review

Description Bertrand Lorentz 2008-11-10 21:41:16 UTC
I stumbled upon this by chance : the regex in Hyena.StringUtil.CamelCaseToUnderCase is re-created for each call.
I'll attach a patch to make the regex static

Here the relevant "mono --profile" output before the patch :
Time(ms)      Count P/call(ms) Method name
########################
 1628.804     146   11.156   System.Text.RegularExpressions.Regex::Split(string,string)
  Callers (with count) that contribute at least for 1%:
         146  100 % Hyena.StringUtil::CamelCaseToUnderCase(string,char)


After the patch :
########################
 279.055     144    1.938   System.Text.RegularExpressions.Regex::Split(string)
  Callers (with count) that contribute at least for 1%:
         144  100 % Hyena.StringUtil::CamelCaseToUnderCase(string,char)
Comment 1 Bertrand Lorentz 2008-11-10 21:42:10 UTC
Created attachment 122354 [details] [review]
Make the regex a static field
Comment 2 Gabriel Burt 2009-01-13 17:39:43 UTC
Assuming this works for you, Bertrand, feel free to commit post 1.4.2.
Comment 3 Gabriel Burt 2009-01-13 17:55:01 UTC
Whoops, that comment was for a different bug, but it's fine for this one too :)
Comment 4 Bertrand Lorentz 2009-01-21 20:28:58 UTC
This problem has been fixed in our software repository. The fix will go into the next software release. Thank you for your bug report.