Skip to main content

Applicatin Performance (Processing time) is very very slow

12 replies [Last post]
nerj
Offline
Joined: 2009-01-07
Points: 0

I develop a J2ME applicaiton using LWUIT technology and BouncyCastle encryption for security.
But, the application performance is very very slow.
Pls, guide me---------
How to improve the application performance.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
peter__lawrey
Offline
Joined: 2005-11-01
Points: 0

I suggest you try to determine what is running slowly.
I don't know if you can get a profiler :P, but what you can do is alter the code so you can see how much time it spends doing different operations.
If you can get a thread dump, do about a dozen of these can give you a hint as to what it spends most of its time doing.

nerj
Offline
Joined: 2009-01-07
Points: 0

Hi! Thanks for ur reply-----
I used Thread functionality in that. That is for every action I start a NEW THREAD and run it.
Is the performance slow, If more no of Threads are running at a time.
Pls, guide me------------

peter__lawrey
Offline
Joined: 2005-11-01
Points: 0

Creating new threads is slow on a server, so imagine its even slower on a phone.
Try creating a small fixed size thread pool and add tasks to it.

However, the cause of the slowness could be something else. It is better to try and measure the cause of the delay because otherwise you may find you are just guessing.

nerj
Offline
Joined: 2009-01-07
Points: 0

Thank u for reply------
What the fixed size of Thread pool means?
Is it contains small no of threads (runs at a time).

peter__lawrey
Offline
Joined: 2005-11-01
Points: 0

> What the fixed size of Thread pool means?
A pool of threads where the threads are recycled rather than created for each task.
> Is it contains small no of threads (runs at a time).
Not sure what you are trying to say, but it sounds right.

Have a look at
http://java.sun.com/javase/6/docs/api/java/util/concurrent/Executors.html#newFixedThreadPool(int)

nerj
Offline
Joined: 2009-01-07
Points: 0

[b]form.setCommandListener(new ActionListener(){

public void actionPerformed(ActionEvent arg0) {[/b]
Object obj=arg0.getSource();
if(obj==cmdAddAsset){
currentaction=ADD_COMMAND1;
System.out.println("enter into the function");
Form thread=new Form();
thread.start();
}
else if(obj==cmdSaveAsset){
currentaction=SAVE_COMMAND;
Form thread=new Form();
thread.start();
}
else if(obj==cmdUpdate){
currentaction=UPDATE_COMMAND;
Form thread=new Form();
thread.start();
}
else if(obj==cmdCancel){
currentaction=CANCEL_COMMAND;
Form thread=new Form();
thread.start();
}
else if(obj==cmdBack){
currentaction=BACK_COMMAND;
Form thread=new Form();
thread.start();
}
}

});
form.show();
} catch (Exception ex) {
ex.printStackTrace();
}
}

[b]public void run(){[/b]
if(currentaction==BACK_COMMAND){
-------code---------
}else if(currentaction==ADD_COMMAND1){
-------code---------
}else if(currentaction==UPDATE_COMMAND){
save();
}else if(currentaction==EDIT_COMMAND){
-------code---------
}else if(currentaction==SAVE_COMMAND){
save();
}else if(currentaction==CANCEL_COMMAND){
-------code---------
}
}

private void saveAsset() {

}

}[/b]

Here, I used individual Thread(s) for different tasks. But, the application performance is not yet improved.
Pls, give me the solution-----------

peter__lawrey
Offline
Joined: 2005-11-01
Points: 0

I still suggest you profile your application as this may not be the cause and I still suggest you use a thread pool.

nerj
Offline
Joined: 2009-01-07
Points: 0

Thank u for reply---
Can u pls, tell me how to create Thread pool, and maintain it?
Atleast give me the flow to create Thread pool maintainance?
Pls----------

peter__lawrey
Offline
Joined: 2005-11-01
Points: 0
linuxhippy
Offline
Joined: 2004-01-07
Points: 0

Kepp in mind that thread-pools usually are written for JSE, so don't forgot to search for a JME compatible one.

nerj
Offline
Joined: 2009-01-07
Points: 0

Thanks for ur suggestion---------
Can u pls tell me, how to create thread pool for Java ME application, and how to maintain it.
Pls---------
Thanks in advance-----------------

nerj
Offline
Joined: 2009-01-07
Points: 0

Pls, suggest me----------