ramccor / esmska

Automatically exported from code.google.com/p/esmska
0 stars 0 forks source link

Improve start time of the program #378

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It's a nice small program for quick sms sending, but the load time is 
sometimes frustrating. Maybe some speed wise optimalization is possible. I'm on 
linux, java 1.6. 2 core CPU and start time is around 10s! Java is probably not 
the cause.

Thanks.

Original issue reported on code.google.com by vladimir...@gmail.com on 30 May 2011 at 9:19

GoogleCodeExporter commented 9 years ago
Start the program, close it, and start it again. What is the start time of the 
second run?

Original comment by kamil.paral on 30 May 2011 at 9:23

GoogleCodeExporter commented 9 years ago
it's not much better, 8s, still too much.

Original comment by vladimir...@gmail.com on 30 May 2011 at 9:28

GoogleCodeExporter commented 9 years ago
Well, 8s is unusually slow, I admit. The warm (subsequent) run takes usually 
about 4s for me. The cold (first) run can be between 10-20s, that's true. The 
difference between cold and warm run shows how slow your harddisk is, for the 
warm run the files are cached in memory. Since Esmska reads and writes only a 
few very small files in ~/.config/esmska, I can't really help there. All of 
that is really Java platform. By the way it works faster on Windows (not that 
it could help, I know).

As for the warm start (CPU limited), I profiled the application few times in 
the past and didn't find any places where optimization could noticeably help. 
Patches would certainly be welcome, but I personally don't see any place to 
patch.

I can advise you to use system/multiplatform appearance skin, it loads much 
faster than Substance skins. Was that your case?

I'll try to profile the application once again, but the chances of improvement 
are low.

Original comment by kamil.paral on 30 May 2011 at 11:46

GoogleCodeExporter commented 9 years ago
Unfortunately, changing the skin doesn't help. Tried all of them, still on 7-8 
s. Thanks anyway.

Original comment by vladimir...@gmail.com on 30 May 2011 at 12:31

GoogleCodeExporter commented 9 years ago
I found a few places and did some improvements:
https://github.com/kparal/esmska/commit/14f0d94dd3a84ba96411665caeaf026465534974

But I wouldn't expect to cut it down more than by 1 sec. The longest time takes 
to evaluate all gateway scripts, which are written in JavaScript. I can't do 
much about it.

Also, if you have thousands of messages in your history, clearing it could help 
a little too (otherwise don't bother).

Original comment by kamil.paral on 31 May 2011 at 10:08

GoogleCodeExporter commented 9 years ago
ok,thanks,i'll test it when new version is out

Original comment by vladimir...@gmail.com on 1 Jun 2011 at 6:37

GoogleCodeExporter commented 9 years ago
When I delete all gateways from disk except of the one I use, Esmska starts 
much faster. Before that I had these gateways disabled. Probably Esmska 
evaluates also disabled gateways?

Original comment by tpika...@gmail.com on 6 Jun 2011 at 12:37

GoogleCodeExporter commented 9 years ago
I can confirm that. It's 5-6s now (2s faster), with unused gateways deleted.

Original comment by vladimir...@gmail.com on 6 Jun 2011 at 1:52

GoogleCodeExporter commented 9 years ago
Yes, the longest time takes to load gateways. And I have to load them all, 
because gateway name is defined inside the script (it may not match filename).

But I won't make you happy, next version of Esmska automatically downloads 
updates, so if you delete some gateway, it will be automatically re-downloaded 
again. (I am not quite sure now what happens if you have disabled the gateway 
before deletion, I have to look at the source code).

If there were more gateways (like dozens), I would probably try to find a 
different approach. But currently it's not worth the effort (but patches 
welcome, of course). I may re-evaluate in the future.

It is also possible that some future Java update may speed up JavaScript 
execution dramatically.

Original comment by kamil.paral on 8 Jun 2011 at 1:47

GoogleCodeExporter commented 9 years ago
> But I won't make you happy, next version of Esmska automatically downloads 
updates, 
> so if you delete some gateway, it will be automatically re-downloaded again. 
> (I am not quite sure now what happens if you have disabled the gateway before 
deletion, 
> I have to look at the source code).

Even if you disable and the delete the gateway, it will be re-download again.

I've tried to approach this problem from a different angle and created issue 
#380.

Original comment by kamil.paral on 8 Jun 2011 at 6:28