ios - Is CGPathContainsPoint() hardware accelerated? -


i'm doing ios game , use method collision detection.

as there plenty (50+) of points check every frame, wondered if method runs on idevice's graphics hardware.

following on @davidrönnqvist point: doesn't matter if it's "hardware accelerated" or not. matters whether fast enough purpose, , can use instruments check eating time , try improve things.

moving code gpu doesn't automatically make faster; can in fact make slower since have haul data on gpu memory, expensive. ideally run on gpu, want move data once, lots of expensive vector operations, , move data (or put on screen). if can't make problem that, gpu isn't right tool.

it possible neon accelerated, again that's kind of irrelevant; compiler neon-accelerates lots of things (and running on neon doesn't mean runs faster, either). said, i'd bet kind of problem run best on neon if can test lots of points (hundreds or thousands) against same curves.

you should assume cgpathcontainspoint() written pretty fast general case of "i have 1 random curve , 1 random point." if problem looks that, seems unlikely beat apple engineers on own hardware (and 50 points isn't more 1). i'd assume, instance, they're checking bounding box , re-check wasting time (but i'd profile sure).

but if can change problem else, "i have known curve , tens of thousands of points," can hand-code better solution , should @ accelerate or hand-written neon attack it.

profile first, optimize. don't assume "vector processor" equivalent "fast" when problem "mathy." graphics processor more-so.


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -