Interesting. You might be right John. I turned on MySQL logging to
see the SQL that ORM was creating and it is this:
SET NAMES latin1;
SET character_set_results = NULL;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
INSERT INTO Child (firstName, lastName, sex, dateOfBirth,
healthCardNumber, medicalConditions, otherAllergies, sickDaysAllowed,
vacationDaysAllowed, depositRequested, deleted, copayType,
copayAmount, Facility_id, Doctor_id, DefaultLocation_id) VALUES
('child1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0,
'No', NULL, NULL, NULL, NULL);
I execute this locally and it runs with no measurable amount of time.
On the server however, it takes anywhere from 16ms to 47ms. Seems like
MySQL on the server runs inserts 10x slower! That's not cool.
I have an Intel Solid State drive on my workstation. Hopefully that
hasn't been giving me an unrealistic view of real-world DB
performance.....
I added another test loop to my test script to get cfquery based SQL
along side the ORM and I got almost the same DB performance! So it
looks like crappy DB performance after all : ( 2000ms to perform 100
inserts!
<cfset tick = getTickCount()>
<cfloop from="1" to="100" index="i">
<cfset child = EntityNew("Child")>
<cfset child.setFirstName("child#i#")>
<cfset EntitySave(child)>
</cfloop>
<cfset endtick = getTickCount()>
<cfset tick2 = getTickCount()>
<cfloop from="1" to="100" index="i">
<cfquery>
INSERT INTO Child (firstName, lastName, sex, dateOfBirth,
healthCardNumber, medicalConditions, otherAllergies, sickDaysAllowed,
vacationDaysAllowed, depositRequested, deleted, copayType,
copayAmount, Facility_id, Doctor_id, DefaultLocation_id) VALUES
('child1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0,
'No', NULL, NULL, NULL, NULL);
</cfquery>
</cfloop>
<cfthrow message="Time for ORM: #endTick - tick#ms and Time for Query:
#getTickCount() - tick2#">
-Brian
On Jun 29, 4:37 am, John Whish <
john.wh...@googlemail.com> wrote:
> I've heard good things abouthttp://
www.jetprofiler.com/for MySQL
> profiling, so that could be a good place to start.
>