Performance of missing dtml-vars
I just noticed that where I was building a form to update a row in the database it could build the form in under 10 seconds. To build the same form to insert a row would take very close to a minute. The same DTML method is used for inserts and updates, the difference being that when doing an update all of the field values are in variables from the SQL method, and for an insert I was just calling the method without initialising anything and relying on <dtml-var missing=""> to set things blank to begin with e.g. lots of: <INPUT TYPE="TEXT" NAME="FIELD_1" VALUE="<dtml-var FIELD_1 null="" missing="">"> <INPUT TYPE="TEXT" NAME="FIELD_2" VALUE="<dtml-var FIELD_2 null="" missing="">"> ....... And some bits for SELECTS that probably contribute badly to the delays because they can be long loops like. <SELECT NAME="COUNTY_ID:int"> <dtml-in CountyLookupMethod> <OPTION VALUE="<dtml-var lu_county_id>" <dtml-try> <dtml-if "_['COUNTY_ID']==_['lu_county_id']"> selected </dtml-if> <dtml-except> </dtml-try> > <dtml-var lu_county> </dtml-in> </SELECT> I tried setting the values of all the variables to blank before calling the method, and now the insert form pops up in under 10 seconds just like the insert one did. e.g.: <dtml-call "REQUEST.set('FIELD_1', '')"> <dtml-call "REQUEST.set('FIELD_2', '')"> <dtml-call "REQUEST.set('COUNTY_ID', '')"> Is it right that it should take so long? I was surprised that it made such a difference. Neil Smith ********************************************************************** The information contained in this e-mail is confidential and intended only for the use of the addressee. If the reader of this message is not the addressee, you are hereby notified that you have received this e-mail in error and you must not copy, disseminate, distribute, use or take any action as a result of the information contained in it. If you have received this e-mail in error, please notify postmaster@npower.com (UK 01384 275454) and delete it immediately from your system. Neither Npower nor any of the other companies in the Innogy group from whom this e-mail originates accept any responsibility for losses or damage as a result of any viruses and it is your responsibility to check attachments (if any) for viruses. Npower Limited Registered office: Windmill Hill Business Park, Whitehill Way, Swindon SN5 6PB. Registered in England and Wales: number 3653277 This e-mail may be sent on behalf of a member of the Innogy plc group of companies. **********************************************************************
participants (1)
-
Smith, Neil