Iterators with Jade 6
Posted: 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
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