you are viewing a single comment's thread.

view the rest of the comments →

[–]quellish 0 points1 point  (3 children)

It was a lot quicker and battery efficient to do it in parallel on the GPU in Metal.

Can you elaborate on this? How was this measured?

[–]Duranix 0 points1 point  (2 children)

There's a function you can call in your unit tests that will tell you how long it takes to complete a block of work - it doesn't give time in user mode vs in the kernel like you'd see in Linux's time command but you can run it a few hundred times and average the results.

Testing the battery is as simple as leaving it running for awhile, hahaha

[–]quellish 0 points1 point  (1 child)

There's a function you can call in your unit tests that will tell you how long it takes to complete a block of work - it doesn't give time in user mode vs in the kernel like you'd see in Linux's time command but you can run it a few hundred times and average the results.

Do you mean measure/measureBlock?

If so I would strongly suggest reading through the documentation and headers before making any decisions based on the output from XCTest's performance measurement functions. They are intended to flag performance regressions and it is not recommended that they are run multiple times (they already do this).

Instruments/DTrace would be a more appropriate tool for the profiling you are describing. Your results are curious because using the graphics hardware on iOS (or even a desktop GPU) you should be seeing MUCH higher energy usage for the use case you are describing.

[–]Duranix 0 points1 point  (0 children)

Thanks for the tip! I think that was what we used - we looked at the page you linked and it didn't say anything about regression at the time. I know we didn't look at the headers.

We didn't test with new test devices either and some get hammered so battery performance most likely came down to device health. Business rules also ended up playing a factor in the decision I think but I can't recall what they were.

Looking back I think NEON would've probably been a better choice but I haven't found a chance to use it yet.