Found my slowdown. FYI.
The real problem with -sortedArrayUsingSelector: is not the algorithm, but that you have an objc-message-send for every comparison. I've written a sorter, in objc, that computes a floating point value for every object once, and compares those for sorting. It uses a primitive merge sort, but it's at least an order of magnitude faster than -sortedArrayUsingSelector:. It is one message send for each object, instead of one for each compare.
arekkusu Wrote:Pah. Real coders emulate 6502 in geometry shaders
Touche.

That's a bit beyond me at the mo'.
DoG Wrote:The real problem with -sortedArrayUsingSelector: is not the algorithm, but that you have an objc-message-send for every comparison. I've written a sorter, in objc, that computes a floating point value for every object once, and compares those for sorting. It uses a primitive merge sort, but it's at least an order of magnitude faster than -sortedArrayUsingSelector:. It is one message send for each object, instead of one for each compare.
Good point - I don't know how I missed that. Oh, yes I do. Incompetence.

Out of interest:
I was using the selector to sort by texture ID. I presume everyone else uses it on Zs instead of depth-testing. Or are you ordering by other GL states?
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Symbol(s) not found using oalTouch example code | monteboyd | 2 | 2,880 |
Sep 26, 2010 10:49 PM Last Post: monteboyd |
|
| Slowdown while playing many OpenAL sounds and accessing AVAudioPlayer.playing | Rasterman | 6 | 4,678 |
Aug 31, 2010 09:46 PM Last Post: headkaze |
|
| Texture2D class Found | Gillissie | 1 | 2,904 |
Mar 16, 2009 03:49 PM Last Post: jeonghyunhan |
|
| error: framework not found ApplicationServices | kancho | 1 | 3,270 |
Nov 23, 2008 11:33 PM Last Post: OneSadCookie |
|


