Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > memory bandwidth?

memory bandwidth?
Thread Tools
Fresh-Faced Recruit
Join Date: Oct 2002
Location: Vancouver, Canada
Status: Offline
Reply With Quote
Nov 16, 2005, 03:26 AM
 
I just purchased a new G5 iMac so I pulled an old project that I had been working on some years ago. A large portion of the cpu time in the code goes to blitting the screen. After experimenting a bit I discovered the performance to be VERY poor. I created a test application that simply creates an offscreen GWorld, paints it red and blits it to the screen a hundred times. I'm getting a throughput of around 140Mbytes/sec. What is going on? here is the snippet (copybits is even slower)

GWorldPtr offscreenGW = NULL;
Rect r = {0,0,900,1440};
Ptr screenBase = (*((*GetMainDevice())->gdPMap))->baseAddr;
Ptr offscreenBase;

//the screen resolution 1440x900x32bit
UInt32 bytes = 900*1440*4;

NewGWorld(&offscreenGW, 32, &r, 0,0,0);
SetGWorld(offscreenGW, NULL);
ForeColor(redColor);
PaintRect(&r);

//get base address of the offscreen GWorld
offscreenBase = GetPixBaseAddr(GetGWorldPixMap(offscreenGW));

for (int i=0;i<kNumBlits;i++){
memcpy(screenBase, offscreenBase, bytes);
}

any suggestions would be very much appreciated
     
Professional Poster
Join Date: Apr 2001
Location: Long Beach, CA
Status: Offline
Reply With Quote
Nov 22, 2005, 11:20 PM
 
Well, it would be a *lot* faster if you used Core Graphics instead and drew into a CGLayer, blitting that to the screen instead. The CGLayer would be limited to 10.4, but a CGImage would work on any version of OS X. It wouldn't be as fast as a CGLayer, though.

ACSA 10.4/10.3, ACTC 10.3, ACHDS 10.3
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:42 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2