realbasic-nug
[Top] [All Lists]

Re: Mac Vs Win performance and a Crash to Avoid

To: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Subject: Re: Mac Vs Win performance and a Crash to Avoid
From: Brad Hutchings <brad@componentx.com>
Date: Wed, 30 Jun 2010 20:35:54 -0700
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com; domainkeys=neutral (bad format) header.From=brad@componentx.com
Delivered-to: listarchive@realsoftware.com
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=componentx.com; h=Received:Message-Id:From:To:In-Reply-To:Content-Type:Content-Transfer-Encoding:Mime-Version:Subject:Date:References:X-Mailer:X-Identified-User; b=v8G3baItnFHhMycEN9TBgJ3gQQwb4l0fc6br65Bed2RVKnIeRAojVPfOANdxy34/znjMg4h+7Z7tIte53MgZPP71QdTcIhKZZMnVRmRBtaH4e6h7+8aM5AzvIKM6FszZ;
Domainkey-status: bad format
In-reply-to: <EA7A7AED-92EA-4088-BEA6-93CFEA15E1CE@verizon.net>
References: <EA7A7AED-92EA-4088-BEA6-93CFEA15E1CE@verizon.net>
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com
Karen,

I ran into something similar with RealeWriter a few years ago. For starters, make sure you turn background tasks off in your word- wrapping routine.

Second thing is that caching the lines will help a lot. I had TextBlock and TextLine classes and kept my own style arrays for each character in the TextBlock, rather than run arrays.

If you really suspect the graphics class methods, like StringWidth, make a wrapper method and profile. e.g.

function MyStringWidth(extends g as graphics, s as string) returns integer

      return g.StringWidth(s)

   end function

Hope that helps.

-Brad

On Jun 30, 2010, at 8:11 PM, Karen wrote:

I have a routine that has a significant performance issue on OS X, but flies on XP! What the routine does is wraps strings using RB string functions and then uses g.DrawString to draw them.... and this routine gets called a LOT!

Here is the profiler data for that routine doing about the same thing on both platforms. Both are done on the same Mac with XP running in Parallels.

Profiler Data:
OS              Calls           Total           Ave Seconds     %Total Time

Win XP          24018           0.73            0               4.1%
10.6.4          24137           54.72           0.0023          19.5%

It is a real bottleneck on OSX.

While i know Graphics are slower on OSX, how about RB string functions (OR LOOPING)? Are they much slower on OSX than XP too?

If the cause is the actual drawing then there is nothing I can do... If it's the string functions/wrapping I can (with significant work) restructure my code to cache the wrapped strings and only rewrap when needed, and not with every draw. (though that might slow other things down because of extra levels of indirection so more overriding with calls to superclass method after massaging etc)

Any ideas?

BTW I tried the to use g.UseOldRender = True, but doing that caused a crash from the debug run into the OSX crash reporter. It looks like you can't use that setting when using clipped graphics regions.. they don't play nice... SO DO NOT DO THAT!!!

Thanks,
- Karen
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>