Skip to main content

Applicatin Performance (Processing time) is very very slow

11 replies [Last post]
nerj
Offline
Joined: 2009-01-07

Hi! All
I develop an mobile application using new version of LWUIT toolkit, which includes RMS based operations. I also used encryption functionality(BouncyCastle) for security. But, the UI performance is very very slow. If we fill all the data required and perform any RMS operation (Save, update, or delete) , it takes lot of time to give response to user. Not even RMS operation, but also for simple form navigation(Moving from one form to another).
Pls, help me, how to improve performance of the application-------------
Pls, help me--------------------
I am using S60 3rd edition SDK.
I test the application on both N73 and N95 devices.
thanks in advance

Message was edited by: nerj

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Shai Almog

You are opening a thread for every command which will obviously be slow.
Try the LWUIT demo/makeover and if your application doesn't perform
as fast as these two then you probably did something wrong.

> I already using Threading functionality,
> here is my code structure--------
>
> public class Form extends Thread{
>
> public void execute(final Command exitCommand,final
> ActionListener commandListener){
> try {
> Label name;
> Label description;
> Label type;
> Label value;
> Form form=new Form("Form");
> form.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
>
> name = new Label("Name");
> description = new Label("Notes");
> type = new Label("Type");
> value=new Label("Value");
>
> setTxtName(new TextField());
> getTxtName().setConstraint(TextField.ANY);
> getTxtName().setInputMode("Abc");
>
> setTxtDescription(new TextArea(3, 20));
> System.out.println(getTxtDescription().getMaxSize());
> getTxtDescription().setMaxSize(500);
> getTxtDescription().setGrowByContent(false);
> getTxtDescription().setIsScrollVisible(true);
> getTxtDescription().setConstraint(TextArea.ANY);
>
> setCmbType(new ComboBox(types));
>
>
> setTxtValue(new TextField());
> getTxtValue().setConstraint(TextField.DECIMAL);
> getTxtValue().setInputMode("123");
>
> form.addComponent(name);
> form.addComponent(getTxtName());
> form.addComponent(type);
> form.addComponent(getCmbType());
> form.addComponent(value);
> form.addComponent(getTxtValue());
> form.addComponent(description);
> form.addComponent(getTxtDescription());
>
>
> final Command cmdAddAsset=new Command("Add OneMore
> Asset");
> final Command cmdSaveAsset=new Command("Save");
> final Command cmdUpdate=new Command("Update");
> final Command cmdCancel=new Command("Cancel");
> final Command cmdBack=new Command("Back");
>
>
> [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() {
>
> }
>
> }
>
> We show this form by calling execute(,) method from the other form.
> When we perform any operation like Save or Update. It takes lot of
> time to respond.
> Pls, help me------------
> [Message sent by forum member 'nerj' (nerj)]
>
> http://forums.java.net/jive/thread.jspa?messageID=324513
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

Shai Almog
http://lwuit.blogspot.com/

[att1.html]

Chen Fishbein

Hi,
Your code seems fine although you confused me a bit (your thread name is
named "Form" ;-) ).
What are you experiencing? is the UI gets stuck? if your save(),
update() method takes too much time and they don't include any UI stuff
I'm not sure how can I help you.

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> I already using Threading functionality,
> here is my code structure--------
>
> public class Form extends Thread{
>
> public void execute(final Command exitCommand,final ActionListener commandListener){
> try {
> Label name;
> Label description;
> Label type;
> Label value;
> Form form=new Form("Form");
> form.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
>
> name = new Label("Name");
> description = new Label("Notes");
> type = new Label("Type");
> value=new Label("Value");
>
> setTxtName(new TextField());
> getTxtName().setConstraint(TextField.ANY);
> getTxtName().setInputMode("Abc");
>
> setTxtDescription(new TextArea(3, 20));
> System.out.println(getTxtDescription().getMaxSize());
> getTxtDescription().setMaxSize(500);
> getTxtDescription().setGrowByContent(false);
> getTxtDescription().setIsScrollVisible(true);
> getTxtDescription().setConstraint(TextArea.ANY);
>
> setCmbType(new ComboBox(types));
>
>
> setTxtValue(new TextField());
> getTxtValue().setConstraint(TextField.DECIMAL);
> getTxtValue().setInputMode("123");
>
> form.addComponent(name);
> form.addComponent(getTxtName());
> form.addComponent(type);
> form.addComponent(getCmbType());
> form.addComponent(value);
> form.addComponent(getTxtValue());
> form.addComponent(description);
> form.addComponent(getTxtDescription());
>
>
> final Command cmdAddAsset=new Command("Add OneMore Asset");
> final Command cmdSaveAsset=new Command("Save");
> final Command cmdUpdate=new Command("Update");
> final Command cmdCancel=new Command("Cancel");
> final Command cmdBack=new Command("Back");
>
>
> [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() {
>
> }
>
> }
>
> We show this form by calling execute(,) method from the other form.
> When we perform any operation like Save or Update. It takes lot of time to respond.
> Pls, help me------------
> [Message sent by forum member 'nerj' (nerj)]
>
> http://forums.java.net/jive/thread.jspa?messageID=324513
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

Chen Fishbein

Hi,
Actually the performance has improved significantly since the last
version, if you preform heavy tasks make sure not to do them on the EDT
thread, open a new thread for them.

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> Hi! All
> I develop an mobile application using new version of [b] LWUIT toolkit,[/b] which includes RMS based operations. I also used [b]encryption[/b] functionality(BouncyCastle) for security. But, [b]the UI performance is very very slow[/b]. If we fill all the data required and perform any RMS operation (Save, update, or delete) , it takes lot of time to give response to user. Not even RMS operation, but also for simple form navigation(Moving from one form to another).
> Pls, help me, [b]how to improve performance of the application-------------[/b]
> [b]Pls, help me--------------------[/b]
> thanks in advance
> [Message sent by forum member 'nerj' (nerj)]
>
> http://forums.java.net/jive/thread.jspa?messageID=324474
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

nerj
Offline
Joined: 2009-01-07

I already using Threading functionality,
here is my code structure--------

public class Form extends Thread{

public void execute(final Command exitCommand,final ActionListener commandListener){
try {
Label name;
Label description;
Label type;
Label value;
Form form=new Form("Form");
form.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

name = new Label("Name");
description = new Label("Notes");
type = new Label("Type");
value=new Label("Value");

setTxtName(new TextField());
getTxtName().setConstraint(TextField.ANY);
getTxtName().setInputMode("Abc");

setTxtDescription(new TextArea(3, 20));
System.out.println(getTxtDescription().getMaxSize());
getTxtDescription().setMaxSize(500);
getTxtDescription().setGrowByContent(false);
getTxtDescription().setIsScrollVisible(true);
getTxtDescription().setConstraint(TextArea.ANY);

setCmbType(new ComboBox(types));

setTxtValue(new TextField());
getTxtValue().setConstraint(TextField.DECIMAL);
getTxtValue().setInputMode("123");

form.addComponent(name);
form.addComponent(getTxtName());
form.addComponent(type);
form.addComponent(getCmbType());
form.addComponent(value);
form.addComponent(getTxtValue());
form.addComponent(description);
form.addComponent(getTxtDescription());

final Command cmdAddAsset=new Command("Add OneMore Asset");
final Command cmdSaveAsset=new Command("Save");
final Command cmdUpdate=new Command("Update");
final Command cmdCancel=new Command("Cancel");
final Command cmdBack=new Command("Back");

[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() {

}

}

We show this form by calling execute(,) method from the other form.
When we perform any operation like Save or Update. It takes lot of time to respond.
Pls, help me------------

Message was edited by: nerj

nerj
Offline
Joined: 2009-01-07

Pls give me the solution---------
Thanks in advance------------

nerj
Offline
Joined: 2009-01-07

Any one?

alrocar
Offline
Joined: 2008-07-31

Maybe your problem is not related to LWUIT. I've seen you start a thread for each action you want to perform, maybe your problem is related to this. I had a similar problem with threads and I solved using a Thread pool.

Have you tried a profiler to watch the behaviour of your app, number of threads in execution, etc.?

nerj
Offline
Joined: 2009-01-07

Thank u for reply----
My application contain near 20 Modules, each is a seperate Form. And we perform a individual thread for every task(Even navigate to other Form , and also for RMS related task).
Pls, suggest me----------
how to create and maintain Thread pool.
Pls---------

alrocar
Offline
Joined: 2008-07-31

Then probably that's your problem.

Check this link, it was useful to me:

http://www.informit.com/articles/article.aspx?p=30483&seqNum=6

The general idea is to start a reduced number of threads when your applications starts and then delegate them all your background work. You can use a Vector to store the tasks that have to be threaded and every thread consume its work from it.

I recomend you only use threads for tasks that can block the main thread, such as, network operations, file connections, etc. I think you don't need to use a thread to navigate through Forms. Also you can try to lazy initialize your Forms to get a better perfomance.

Hope it helps.

nerj
Offline
Joined: 2009-01-07

Thank u for replying-------
But the package concurrent does n't exists in java me library. Is it right?
Then, how to create Threadpool in java me application.
Pls, help me---------
thank in advance---------

nerj
Offline
Joined: 2009-01-07

Any one------------