Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Posts: 541
Registered: ‎05-17-2009
My Device: Not Specified

Re: about multi-threading and performance

Yes, my analysis would only have applied to the single thread downloading. I think you are correct that there would be fairly consistent downloading with your multi-thread method, unless the parsing is very costly (but then you could just add more threads I imagine).
Trusted Contributor
Posts: 119
Registered: ‎04-29-2010
My Device: Curve 8520
My Carrier: TMN

Re: about multi-threading and performance

Hi! Thks all for the excelent feedback!

Regarding my actual process, the main thread creates 2 additional threads. Each thread gets half of the records. Each thread executes in a loop a HTTP call and a Xml Parse of each record.
So when I have for example 10 records each thread will do 5 http calls and 5 xml parsing. 
For statistics i've been testing this for some time and at the moment the average performance rounds 4 seconds per record (each record makes http call, xml parsing and persistent store saving). And it still has some logging on sdcard wich will be turned off when app is ready. I'm testing the app on a bb curve 8520 wich as you already know has fewer processing power than the majority of newest bb devices.
Of course I have also verified that these processing has some issues regarding device performance and battery consumption but I think that 2 additional threads is a good balance between performance and overall device "health".
In my process i also noticed that the parsing takes a big longer than the http call.
I'm not sure which method to use as there are some things that I still don't understand like "thread pooling", "thread sleeping", "threadpool", device processor context switching etc
I will have to investigate and experiment more but the timeout situations on Http calls can be a important reason when deciding the right method to use.
For getting some conclusion to my initial question i can assume that the creation of new threads is costly to the performance.


best regards!

Tech On!
more at On On On!
Posts: 132
Registered: ‎10-25-2011
My Device: Tour 9630
My Carrier: MTN

Re: about multi-threading and performance

Hello simon please i really need help such as a sample code for a thread pool that will handle tasks thanks.

Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: about multi-threading and performance