Kirix Support Forums

wx2ns taking quadratic time

Please post any wxWebConnect patches or modifications you've created here. Thanks!

wx2ns taking quadratic time

Postby jonmmorgan on Fri Nov 12, 2010 8:39 am

I received a pull request from a fellow BPBible developer for a great efficiency improvement (see http://github.com/jonmmorgan/wxwebconne ... bf1f4b5a91 for the change).

Basically, it seems that wxString::GetChar() is linear rather than constant time. Since this is used for every character in the string, the whole conversion is quadratic time. I assume this isn't too bad for converting comparatively small strings (like URLs) but it made our application really sluggish because we were using protocol handlers and thus every piece of HTML being displayed was being run through a quadratic algorithm.

I suggest it would be worth putting this fix into the next version of wxWebConnect.
jonmmorgan
Registered User
 
Posts: 94
Joined: Fri May 14, 2010 9:48 am

Re: wx2ns taking quadratic time

Postby Ben on Fri Nov 12, 2010 1:02 pm

Hi there,

Thanks for point this out. You are right. We coded this for previous versions of wxWidgits, where this was not the case. However, now that we have this problem, I'll have to fix this little O(n^2) bug.

Ben
Ben Williams
Kirix Support Team
User avatar
Ben
Kirix Support Team
 
Posts: 525
Joined: Mon Dec 19, 2005 6:29 am

Re: wx2ns taking quadratic time

Postby jonmmorgan on Fri Nov 12, 2010 11:14 pm

Just to make sure (based on your comments) you do realise that there is a patch for this? [You are welcome to fix it by yourself if you want to, but if the changes are fine you can incorporate them as is].
jonmmorgan
Registered User
 
Posts: 94
Joined: Fri May 14, 2010 9:48 am

Return to wxWebConnect Patches & Modifications