Caching Regexes in GiGi
Moderator: Committer
Caching Regexes in GiGi
Finally got a patch ready for you all that uses Boost thread local storage to cache the regular expressions used by DetermineLines. You should see a marked speed improvement while switching star systems, going to research, etc.
There are no changes to Font.h.
See also
viewtopic.php?f=9&t=8835
I release these changes under the GPLv2 or later license.
There are no changes to Font.h.
See also
viewtopic.php?f=9&t=8835
I release these changes under the GPLv2 or later license.
- Attachments
-
[The extension patch has been deactivated and can no longer be displayed.]
Last edited by cyanic on Thu Aug 28, 2014 3:09 am, edited 1 time in total.
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Caching Regexes in GiGi
Could you add a signature or line to the post stating that you release the changes under the GPL 2.0 or later?cyanic wrote:Finally got a patch ready...
Re: Caching Regexes in GiGi
Hello,
you've got a typo : "behavoir" in comment
class RegexHelper - wouldn't this be better as a struct ? (I'm not very C++-savvy, so this may be a stupid idea)
I'll test your patch, it may help my poor laptop
you've got a typo : "behavoir" in comment
class RegexHelper - wouldn't this be better as a struct ? (I'm not very C++-savvy, so this may be a stupid idea)
I'll test your patch, it may help my poor laptop
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!
Let's unleash the dyson forest powa!
- adrian_broher
- Programmer
- Posts: 1156
- Joined: Fri Mar 01, 2013 9:52 am
- Location: Germany
Re: Caching Regexes in GiGi
There is no difference between structs and classes beside the default access level for member attributes or functions.vincele wrote:class RegexHelper - wouldn't this be better as a struct ? (I'm not very C++-savvy, so this may be a stupid idea)
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz
Re: Caching Regexes in GiGi
That, I remembered, but thought there was something else...
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!
Let's unleash the dyson forest powa!
Re: Caching Regexes in GiGi
FYI, the patch needs: "patch --binary -p7 < Font.cpp.patch" to apply under linux (CRLF & full path)
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!
Let's unleash the dyson forest powa!
Re: Caching Regexes in GiGi
The patch builds and runs, no bugs found, but the sidepanel display when switching systems does not seem vastly faster with the patch. BTW this is for an LLVM clang-3.6 DEBUG build under linux...
Opening to prodwnd seems faster, as well as a full researchwnd seems more responsive to move around, very unscientific testing report...
Opening to prodwnd seems faster, as well as a full researchwnd seems more responsive to move around, very unscientific testing report...
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!
Let's unleash the dyson forest powa!
Re: Caching Regexes in GiGi
Yes, behavoir is a typo.vincele wrote:Hello,
you've got a typo : "behavoir" in comment
class RegexHelper - wouldn't this be better as a struct ? (I'm not very C++-savvy, so this may be a stupid idea)
I'll test your patch, it may help my poor laptop
I left RegexHelper as a class due to my own style of classes being something you should "new" (as is done by RegexHelperPerThread) and structs being something just declared. I don't care if you all change it to struct, but be aware that the boost xpressive library is very exacting with its types and it can be annoying (hundred line error messages) to keep it happy when things are changed.
Re: Caching Regexes in GiGi
I believe someone else found a way to not call DetermineLines when moving TextControl around, so that's probably why moving the full researchwnd is more responsive for you.vincele wrote:The patch builds and runs, no bugs found, but the sidepanel display when switching systems does not seem vastly faster with the patch. BTW this is for an LLVM clang-3.6 DEBUG build under linux...
Opening to prodwnd seems faster, as well as a full researchwnd seems more responsive to move around, very unscientific testing report...
viewtopic.php?f=9&t=8980
I'm testing on MSVC 2010 Windows 7, profiling using Very Sleepy. I tested by loading FreeOrion, quick starting, clicking back and forth between the home and nearest star system (to deal with any one-time loads) and then clicking back and forth between the home and closest star system 5 times (so 10 total transitions, waiting until everything has finished loading on one transition before doing the next).
So now some real numbers:
Testing against SVN 7634 - 10 star system selections between Escher Alpha and Wedge Beta
without patch:
Trial 1: operator new: 3.38s | free: 3.15s (about 30% of calls come from boost::xpressive)
Trial 2: operator new: 3.81s | free: 2.96s
Trial 3: operator new: 3.26s | free: 2.80s
with patch:
Trial 1: operator new: 3.79s | free: 2.08s
Trial 2: operator new: 4.86s | free: 2.85s
Trial 3: operator new: 3.42s | free: 2.01s
Average without patch
operator new: 3.48s | free: 2.97s
Average with patch
operator new: 4.02s | free: 2.31s
Free and operator new are the two most prominent elements in the profile report (if you disqualify Sleep).
So it looks like, on average, the gains in free are lost in new. That being said, the public release 0.4.3 (SVN 7108) spends almost no time in operator new under a similar test, so maybe something good will come when it is built for public release.
Now, because it took months for me to get this patch to you (had to learn way more about boost than I expected), I think most of my thunder has been stolen by smarter usage of TextControl (so DetermineLines is called less than it was in SVN 7115 when I started).
Re: Caching Regexes in GiGi
Maybe you can do a quick test with you patch applied before and after r7383, that'll tell you if it's that one.cyanic wrote:Now, because it took months for me to get this patch to you (had to learn way more about boost than I expected), I think most of my thunder has been stolen by smarter usage of TextControl (so DetermineLines is called less than it was in SVN 7115 when I started).
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!
Let's unleash the dyson forest powa!
Re: Caching Regexes in GiGi
For anyone on windows having trouble applying that patch, here is a remade patch that should be usable by TortoiseSVN
- Attachments
-
[The extension patch has been deactivated and can no longer be displayed.]
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0
Re: Caching Regexes in GiGi
It appears that this patch breaks the multi-line file dialog rows. Without it my savegame load dialog is fine, but with it I get this:
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0
Re: Caching Regexes in GiGi
Are you sure, I've seen it but remember looking at the same thing in an unpatched FO and also seeing the bug, maybe I mixed some of my binaries...Dilvish wrote:It appears that this patch breaks the multi-line file dialog rows.
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!
Let's unleash the dyson forest powa!
Re: Caching Regexes in GiGi
Totally sure; I just confirmed it-- clean build, no problem, apply the patch and rebuild, get the problem shown above.vincele wrote:Are you sure, I've seen it but remember looking at the same thing in an unpatched FO and also seeing the bug, maybe I mixed some of my binaries...Dilvish wrote:It appears that this patch breaks the multi-line file dialog rows.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0