Performance tuning in Cocoa application
Asked Answered
F

3

0

I am developing a Cocoa application which communicates constantly with a web service to get up-to-date data. This considerably reduces the performance of the application. The calls are made to the web service asynchronously but the number of calls is huge.

In what ways can I improve the performance of the application? Is there a good document/write up available which gives the best practices to be followed when an a Cocoa application communicates with a web service?

Thanks

Favien answered 7/1, 2009 at 14:27 Comment(0)
A
2

Yes! Apple actually has some very concise guides on performance that cover a lot of tricks and techniques, I'm sure you'll find something relevant to your own application. There may be some additional guides specific to 10.5 I haven't seen yet, but here are three I've found useful in the past.

The most important thing to take away though, is that you need to use performance tools to see exactly where the bottleneck is occurring. Sometimes it may be in the place you least expect it.

Acro answered 7/1, 2009 at 15:25 Comment(1)
Thanks a lot for the documents. They really helped.Favien
P
3

You should try out Shark that comes with the Mac OS X devtools - really great for digging into your callstack and should allow you to limit to network libraries and friends.

Pneumodynamics answered 7/1, 2009 at 14:33 Comment(0)
G
2

I think if you use Shark your just find your app is blocking waiting for answers back from the server. Code split across machines is far harder to benchmark as the standard tools can only benchmark part of the picture.

Sounds like you need to look into bundling calls up into fewer transactions.... Your bottleneck is almost certainly the network. What about supporting sending multiple calls as an array of calls? and the same for answers? Maybe you could buffer calls locally and only send them a few times a second as a single transaction?

Tony

Gothic answered 7/1, 2009 at 14:40 Comment(1)
Thanks for the suggestion Anthony. The problem here is I am making these calls to read the contents of a file on the server and am sending requests with a range of bytes to be read (as the request comes from the kernel) so can't really stack requests together and send them. The kernel won't wait :)Favien
A
2

Yes! Apple actually has some very concise guides on performance that cover a lot of tricks and techniques, I'm sure you'll find something relevant to your own application. There may be some additional guides specific to 10.5 I haven't seen yet, but here are three I've found useful in the past.

The most important thing to take away though, is that you need to use performance tools to see exactly where the bottleneck is occurring. Sometimes it may be in the place you least expect it.

Acro answered 7/1, 2009 at 15:25 Comment(1)
Thanks a lot for the documents. They really helped.Favien

© 2022 - 2024 — McMap. All rights reserved.