One other thing – are you testing
the time in production mode? If you’re in development it’ll
probably be pretty slow for you. Production caches a lot more data and, in
general, is much faster.
Doug
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf
Of Daryl
Sent: Thursday, April 20, 2006
9:06 PM
To: [email protected]
Subject: Re: [Reactor For CF]
Using iterator method(s) to create/insert a record into a table doubles
execution time?
On 4/20/06, Doug Hughes <[EMAIL PROTECTED]>
wrote:
> Can you clarify this?
>
> Doug
>
> relative speeds are about the same without debugging:
>
there's more code in the cfcs than these calls, but these calls are the only
difference between the two cfcs:
267 milliseconds not using iterator add()
<!----------------------------
==============================
EVENT PHOTOS
INSERT
==============================
----------------------------->
<!--- create a
record --->
<cfset
Event_Photos_Record = Reactor.createRecord("Event_Photos") />
<!--- populate the
new record --->
<CFSET sScheduleID
= LEFT( arguments.Photo_ID,5)>
<CFSET sCameraID =
MID(arguments.Photo_ID,6,3)>
<CFSET
sSequence_Num = RIGHT(arguments.Photo_ID,5)>
<cfset this_path =
"/photos/" & sScheduleID & "/" & sCameraID
& "/" & sSequence_Num & ".jpg">
<cfset
Event_Photos_Record.SETEVENT_PHOTO_ID("#arguments.PHOTO_ID#")>
<cfset
Event_Photos_Record.SETPATH("#trim(this_path)#")>
<cfset
Event_Photos_Record.SETPHOTO_ENVIRONMENT_ID("#arguments.WATERMARK_ID#")>
<cfset
Event_Photos_Record.SETR_ELAT_ID("#Photo_Loc_R_ELAT_ID#") />
<cfset
Event_Photos_Record.SETEVENT_DAY_ID("#arguments.SUB_EVENT_DATE_ID#")
/>
<cfset
Event_Photos_Record.SETCLIENT_LICENSE_ID("#efn_client_licenseID#")
/>
<cfset
Event_Photos_Record.SETSYSTEM_ID("#arguments.CAMERA_ID)#")>
<cfset
Event_Photos_Record.SETSEQUENCE_ID("#arguments.sSequence_Num#")>
<cfset
Event_Photos_Record.SETCREATE_DTM(#arguments.CREATE_DTM#) />
<cfset
Event_Photos_Record.SETSAMPLE_FLAG("0")>
<!--- save the
record --->
<cfset
Event_Photos_Record.save() />
<cfset
inserted_id_event_photos = Event_Photos_Record.GETEVENT_PHOTO_ID()>
<!----------------------------
==============================
FOOTPRINTS
INSERT
==============================
----------------------------->
<!--- create a
record --->
<cfset
Footprints_Record = Reactor.createRecord("Footprints") />
<!--- populate the
new record --->
<cfset
Footprints_Record.SETEVENT_TOKEN_ID("#arguments.BARCODE_ID#")>
<cfset
Footprints_Record.SETR_ELAT_ID("#Photo_Loc_R_ELAT_ID)#") />
<cfset
Footprints_Record.SETEVENT_DAY_ID("#arguments.SUB_EVENT_DATE_ID#")
/>
<cfset
Footprints_Record.SETCLIENT_LICENSE_ID("#efn_client_licenseID)#")
/>
<cfset
Footprints_Record.SETSYSTEM_ID("#arguments.CAMERA_ID#")>
<cfset
Footprints_Record.SETCREATE_DTM("#arguments.CREATE_DTM#") />
<cfset
Footprints_Record.SETSAMPLE_FLAG("0")>
<cfset
Footprints_Record.SETIP_ADDRESS("")>
<!--- save the
record --->
<cfset
Footprints_Record.save() />
<Cfset
inserted_id_footprints_loc = Footprints_Record.GETFOOTPRINT_ID()>
<!--- Footprints_ID
(loc): <cfoutput>#inserted_id_footprints_loc#</cfoutput><br>
--->
<!------------------------
==========================
R_FOOTPRINT_PHOTO
INSERT
==========================
------------------------>
<!--- create a
Record --->
<cfset
R_Footprint_Photo_Record = Reactor.createRecord("R_Footprint_Photo")
/>
<!--- populate the
new record --->
<cfset
R_Footprint_Photo_Record.SETEVENT_PHOTO_ID("#inserted_id_event_photos#")
/>
<cfset
R_Footprint_Photo_Record.SETFOOTPRINT_ID("#inserted_id_footprints_loc#")
/>
<!--- save the
record --->
<cfset
R_Footprint_Photo_Record.save() />
426 milliseconds using the iterator calls
the iterator is based on a linking table relationship
<!----------------------------
==============================
EVENT PHOTOS
INSERT
==============================
----------------------------->
<!--- create a
record --->
<cfset
Event_Photos_Record = Reactor.createRecord("Event_Photos") />
<!--- populate the
new record --->
<CFSET sScheduleID
= LEFT(arguments.Photo_ID,5)>
<CFSET sCameraID =
MID(arguments.Photo_ID,6,3)>
<CFSET
sSequence_Num = RIGHT( arguments.Photo_ID,5)>
<cfset this_path =
"/photos/" & sScheduleID & "/" & sCameraID
& "/" & sSequence_Num & ".jpg">
<cfset
Event_Photos_Record.SETEVENT_PHOTO_ID("#arguments.PHOTO_ID#">
<cfset
Event_Photos_Record.SETPATH("#trim(this_path)#")>
<cfset
Event_Photos_Record.SETPHOTO_ENVIRONMENT_ID("#arguments.WATERMARK_ID#")>
<cfset
Event_Photos_Record.SETR_ELAT_ID("#Photo_Loc_R_ELAT_ID#") />
<cfset
Event_Photos_Record.SETEVENT_DAY_ID("#arguments.SUB_EVENT_DATE_ID#")
/>
<cfset
Event_Photos_Record.SETCLIENT_LICENSE_ID("#efn_client_licenseID#")
/>
<cfset
Event_Photos_Record.SETSYSTEM_ID("#arguments.CAMERA_ID#")>
<cfset
Event_Photos_Record.SETSEQUENCE_ID("#arguments.sSequence_Num#")>
<cfset
Event_Photos_Record.SETCREATE_DTM(#arguments.CREATE_DTM#) />
<cfset
Event_Photos_Record.SETSAMPLE_FLAG("0")>
<!--- save the
record --->
<cfset
Event_Photos_Record.save() />
<cfset
inserted_id_event_photos = Event_Photos_Record.GETEVENT_PHOTO_ID()>
<!----------------------------
==============================
FOOTPRINTS
INSERT
==============================
----------------------------->
<!--- <cfset
FootprintsItArray =
Event_Photos_Record.GETFOOTPRINTSITERATOR().GetArray()/> --->
<cfset Footprint
= Event_Photos_Record.getFootprintsIterator().add()/>
<!--- populate the
new record --->
<cfset
Footprint.SETEVENT_TOKEN_ID("#arguments.BARCODE_ID#")>
<cfset
Footprint.SETR_ELAT_ID("#Photo_Loc_R_ELAT_ID#") />
<cfset
Footprint.SETEVENT_DAY_ID("#arguments.SUB_EVENT_DATE_ID#") />
<cfset
Footprint.SETCLIENT_LICENSE_ID("#efn_client_licenseID#") />
<cfset
Footprint.SETSYSTEM_ID("#arguments.CAMERA_ID#")>
<cfset
Footprint.SETCREATE_DTM("#arguments.CREATE_DTM#") />
<cfset
Footprint.SETSAMPLE_FLAG("0")>
<cfset
Footprint.SETIP_ADDRESS("")>
<!--- save the
record --->
<cfset
Footprint.save() />
<Cfset
inserted_id_footprints_loc = Footprint.GETFOOTPRINT_ID()>
<!------------------------
==========================
R_FOOTPRINT_PHOTO
INSERT
==========================
------------------------>
<!--- create a
Record --->
<cfset
R_Footprint_Photo =
Event_Photos_Record.getR_Footprint_PhotoIterator().add()/>
<!--- populate the
new record --->
<cfset
R_Footprint_Photo.SETEVENT_PHOTO_ID("#inserted_id_event_photos#")
/>
<cfset
R_Footprint_Photo.SETFOOTPRINT_ID("#inserted_id_footprints_loc#")
/>
<!--- save the
record --->
<cfset
R_Footprint_Photo.save() /> -- Reactor for ColdFusion Mailing List -- [email protected] -- Archives at
http://www.mail-archive.com/reactor%40doughughes.net/
-- Reactor for ColdFusion Mailing List --