0

GenericForwardComposer slow

asked 2010-05-31 04:08:14 +0800

xmedeko gravatar image xmedeko
1021 1 16
http://xmedeko.blogspot.c...

updated 2010-05-31 07:03:08 +0800

Hi, I have started using GenericForwardComposer with ZK Calendar (<calendars>) component and I have experienced a recognizable delay, when I have access the page with the ZK Calendar first time. I suspect, the auto-wiring in not very fast. Measured times on my Dual Core @2.5GHZ:

doAfterCompose: first time (just after server starts): 391ms, next time (next time the page is accessed and the controller is cerated) 188ms
between doAfterCompose and onCreate: first time: 359ms, next time 156ms

total slow down: first time: 750ms, next time: 344ms

Moreover, the "nexttime" total processing time shown by the Firebug is about 490ms, so 344/490 = 70% of the processing time taken by the auto-wiring.

I think these times are too high. The auto-wiring (and addForwards, too) should be optimized.

delete flag offensive retag edit

17 Replies

Sort by ยป oldest newest

answered 2010-05-31 21:23:55 +0800

SimonPai gravatar image SimonPai
1696 1

Hi xmedeko,

I think we need to do some research on this issue. Can you provide information about your environment so we can reproduce and test?
In addition, if you get more statistics about this issue, please post it here so we can take it as a reference. Thanks in advance.

Regards,
Simon

link publish delete flag offensive edit

answered 2010-06-01 01:37:23 +0800

xmedeko gravatar image xmedeko
1021 1 16
http://xmedeko.blogspot.c...

Hi Simon,
environment: ZK 3.6.4, JBoss 5.1, Sun JDK 1.6u18, Win XP. I am using GenericForwardComposer extensively, and only one pages takes so long, I'll try to discover, where exactly is the problem.

link publish delete flag offensive edit

answered 2010-06-01 02:31:39 +0800

ashishd gravatar image ashishd flag of Taiwan
1972 6

Hi xmedeko,
Do you happen to use any DelegatingVariableResolver(s) on that page? There was a similar bug wrt ZK Spring and it was fixed. Please take a look if it has something in your case.

Thanks
- Ashish

link publish delete flag offensive edit

answered 2010-06-01 03:27:22 +0800

xmedeko gravatar image xmedeko
1021 1 16
http://xmedeko.blogspot.c...

@ashishd: Nope, I do not use spring.

@SimonPai: All the time is spent in Wire.wireOthers method. I have looked into the code of the Components class and it is not well regarding to the performance. The code should avoid any unnecessary casting, instanceof operators, string and collections operations, etc. I have tried to remove ZScriptVariables lookup from containsVariable, and it has lead to some speedup. (I do not need this feature and I guess most of the folks do not need it, too.) My version of this method:

		private boolean containsVariable(Object x, String fdname) {
			//#feature 2770471 GenericAutowireComposer shall support wiring ZScript varible
			if (x instanceof Page) {
				final Page pg = (Page) x;
				return //pg.getZScriptVariable(fdname) != null ||
					 pg.containsVariable(fdname);
			} else {
				final Component cmp = (Component) x;
				//final Page page = getPage(cmp);
				return //(page != null && page.getZScriptVariable(cmp, fdname) != null) ||
					cmp.containsVariable(fdname, false);
			}
		}

Now, the auto-wiring takes approx. 140ms instead of 390. It is interesting, that the first call of the wireOthers is approx. 20ms, while the second call is 120ms. The first call is made by doAfterCompose method, while the second one by BeforeCreateWireListener hook.

link publish delete flag offensive edit

answered 2010-06-01 03:38:45 +0800

xmedeko gravatar image xmedeko
1021 1 16
http://xmedeko.blogspot.c...

updated 2010-06-01 03:40:06 +0800

Well, I have removed the ZScriptVariables lookup from getVariable, and the wireOthers time has dropped to 0 (yeah!). My version is:

		private Object getVariable(Object x, String fdname) {
			//#feature 2770471 GenericAutowireComposer shall support wiring ZScript varible
			if (x instanceof Page) {
				final Page pg = (Page) x;
				//Object arg = pg.getZScriptVariable(fdname);
				//if (arg == null) {
					Object arg = pg.getVariable(fdname);
				//}
				return arg;
			} else {
				final Component cmp = (Component) x;
				//final Page page = getPage(cmp);
				//Object arg = page != null ? page.getZScriptVariable(cmp, fdname): null;
				//if (arg == null) {
					Object arg = cmp.getVariable(fdname, false);
				//}
				return arg;
			}
		}

link publish delete flag offensive edit

answered 2010-06-01 03:54:25 +0800

SimonPai gravatar image SimonPai
1696 1

xmedeko, thanks a lot for your code and statistics contribution. :-)

Simon

link publish delete flag offensive edit

answered 2010-06-01 07:27:36 +0800

xmedeko gravatar image xmedeko
1021 1 16
http://xmedeko.blogspot.c...

Simon, I hope some solution how to disable ZScriptVariables lookup will appear in the next release of ZK.

link publish delete flag offensive edit

answered 2010-06-01 09:49:06 +0800

robertpic71 gravatar image robertpic71
1275 1

>> Simon, I hope some solution how to disable ZScriptVariables lookup will appear in the next release of ZK.

+1

/Robert

link publish delete flag offensive edit

answered 2010-06-01 15:33:21 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

I would be happy too, 'cause i don't need ZScript vars.

link publish delete flag offensive edit

answered 2010-06-01 21:03:28 +0800

PeterKuo gravatar image PeterKuo
481 2

I added it to feature request.
https://sourceforge.net/tracker/?group_id=152762&atid=785194

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-05-31 04:08:14 +0800

Seen: 1,119 times

Last updated: Jun 09 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More