-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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.
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
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.
@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.
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; } }
Simon, I hope some solution how to disable ZScriptVariables lookup will appear in the next release of ZK.
>> Simon, I hope some solution how to disable ZScriptVariables lookup will appear in the next release of ZK.
+1
/Robert
I would be happy too, 'cause i don't need ZScript vars.
Asked: 2010-05-31 04:08:14 +0800
Seen: 1,119 times
Last updated: Jun 09 '10