Iterators with Jade 6

The use of specific JADE features and proposals for new feature suggestions
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Iterators with Jade 6

Postby ConvertFromOldNGs » Fri Aug 07, 2009 10:55 am

by Stephen Persson >> Tue, 10 Feb 2004 3:30:17 GMT

Hi,
Having a few issues with iterators under Jade 6 and hoping someone can clarify whats happening with them now. Our framework for running reports is basically as follows:

runReport () clientExecution;begin

.....
if prepareReportData then
write "prepare data completed " & app.actualTimeServer.String;
...display the report
endif;
.....
end;

where prepareReportData is a serverExecution method that does all the number crunching for the report back on the server (app is run as a thin client).

My problem is that some reports now under Jade 6 take an extraordinary amount of time changing from the serverExection method back to the clientExecution method.
If I put a write statement in the epilog of the serverExection method giving me the server date/time, and another write statement back on the client method (immediately following the call to the serverExecution method) I get the following for one of my reports : prepareReportData epilog completed 10 February 2004, 15:40:59
prepare data completed 10 February 2004, 15:43:31

Its taking 2 1/2 minutes to switch from the serverExecution back to the client Execution method! If I remove the serverExecution on the prepareReportData method, the report runs like a dog, but there is no delay between the server and client execution methods, it is instant.

I then had a wade through the code and found that there were a lot of calculations on the individual accounts that used iterators to go through the account transactions. I replaced all these iterators with foreach statements using the new discreteLock feature in Jade 6, and this completely got rid of the time delay.

So after all that..... my question is whats up now with iterators? Why are they now soooo slow? (This wasn't happening with Jade 5.2) It seems to be really slow at the create/delete stages, so if you are creating and deleting thousands of iterators as part of a report running you're in trouble, and I now need to use a foreach statement instead. But what do you do if you need to do a startAtKey on the collection? If you don't want to parse the entire collection then you have to use an iterator, but then you are back to this enormous delay as it switches between serverExecution & clientExecution...?!?

Thanks
Stephen Persson

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Iterators with Jade 6

Postby ConvertFromOldNGs » Fri Aug 07, 2009 10:55 am

by allistar >> Tue, 10 Feb 2004 8:55:48 GMT

Hi Stephen,
When switching between client execution and serverExecution (and vice-versa) transient objects are transferred betwen the two nodes. I'm not sure how JADE determines which transients to transfer, supposedly only the ones that are actually used (someone who is more in the know about this can possibly help).

Once thing to check is that you are in fact deleting all iterators that you create. There are methods on the Class class for telling how many transient instances of a class there are, see if that reports a transient object leak. Maybe transients are leaking and when switching back to client execution they are all being transferred from the server?

Allistar.

------------------------------------------------------------------
Allistar Melville
Software Developer, Analyst allistar@silvermoon.co.nz
Auckland, NEW ZEALAND

Silvermoon Software
Specialising in JADE development and consulting
Visit us at: http://www.silvermoon.co.nz
*NEW* Simple web access to Jade at: www.silvermoon.co.nz/jhp.html ------------------------------------------------------------------


Return to “Feature Discussions”

Who is online

Users browsing this forum: No registered users and 18 guests