Contact Doug!
Learn About Doug!
View Doug Boude's online resume
updated 11/18/2009

View Doug Boude's profile on LinkedIn
Link to me!

Follow Doug Boude on Twitter
Follow me!

Be Doug's friend on Facebook
Befriend me!
(I promise not to follow you home)
OO Lexicon
Chat with Doug!
Recent Entries
You may also be interested in...
Florida web site design



Czech your Page Rank!
Check Page Rank of any web site pages instantly:
This free page rank checking tool is powered by Page Rank Checker service
Surf's Up!
Visit Egosurf.org and massage YOUR web ego!
My Score: 9,001
Doug's Books

Read (and recommend)

  • Men are from Mars, Women are from Venus
  • The Wisdom of Crowds: Why the Many Are Smarter Than the Few and How Collective Wisdom Shapes Business, Economies, Societies and Nations
  • Blink: The Power of Thinking Without Thinking
  • Head First Design Patterns
  • Transact-SQL Programming
  • What's So Amazing About Grace?
  • Just So Stories (Rudyard Kipling collection)

Reading

  • Prayer: Does it Make Any Difference?
  • Data Mining (Practical Machine Learning Tools and Techniques)
<< March, 2010 >>
SMTWTFS
123456
78910111213
14151617181920
21222324252627
28293031
Search Blog

Recent Comments
Categories
Archives
Photo Albums
Funnies (5)
Family (3)
RSS

Powered by
BlogCFM v1.11

27 May 2008
Model-Glue 'Generic Read' Time Tests

It's in the wee hours of the night and I'm trying to knock out one more item from my client's laundry list: speed up the load time of a specific template in his Model Glue app.

This particular template has several different select lists, each being populated with the results of a Model-Glue generic List broadcast. It also relies upon the return of a pre-populated object that is fairly "heavy" as far as Reactor-defined objects go (many hasOne/hasMany relationships), it being retrieved via a MG generic Read. (if you're not familiar with Model-Glue's generic database messages, check out the MG Docs). So, the first thing I thought to do was find out if a generic message was the most efficient way to interact with Reactor.

I created a simple method in my controller that, for all intents and purposes, duplicated the functionality of the generic Read:

<cffunction name="getRecordObject" access="public" output="false" returntype="void">
 <cfargument name="event" type="any" required="yes" />
 <cfset var reportID = arguments.event.getValue("reportID",0) />
 <cfset var retVal = "" />
 <cfset retVal = getModelGlue().getORMService().createRecord("Report").load(ReportID=reportID) />
 <cfset arguments.event.setValue("ReportRecord",retVal) />
</cffunction>

I then modified my modelglue.xml, commenting out the generic Read and replacing it with a message to my replacement method:

<!--

<message name="ModelGlue.genericRead">
 <argument name="recordName" value="ReportRecord" />
 <argument name="criteria" value="ReportID" />
 <argument name="object" value="Report" />
</message>

-->


<message name="getRecordObject" />

Now for some time tests based on Model-Glue's debugging output!

 

 

The results showed that, after the application's initialization ("init=true"), the generic Read was an average of THREE TIMES FASTER than the manual record creation using the ORM Service (99ms VS 307ms) . During initialization, the manual record creation was an average of 26 TIMES FASTER (422ms VS 11,070ms)! But, how often do you really need to reinitialize your app? I'll be sticking with the generic Read.

I didn't dig too deeply into why the performance differences might be there, but I did notice that the Model Glue's implementation of the generic Read is utilizing the ORMAdapter and the 'read/new' methods, whereas the manual call examples I found to create a Record object use the ORMService and the 'createRecord' method. Not sure what the difference there is, but there must be one.

Anyway, just thought I'd toss that out there as some rough empirical evidence to support the use of MG's generic messages (if your app uses an ORM  ).

P.S. If you're interested in the raw data(er), well, it was just too bulky and boring to take up blog space with it. If you really want to see the actual times, though, here they are.




Posted by dougboude at 2:05 AM | PRINT THIS POST! |Link | 1 comment
Subscription Options

You are not logged in, so your subscription status for this entry is unknown. You can login or register here.

Re: Model-Glue 'Generic Read' Time Tests
Doug, if you want even more speed, just stick your sql or stored procedure call inside a gateway method and use the generic read message to call that.
Posted by Boyan Kostadinov on May 28, 2008 at 8:48 AM

Name:   Required
Email:   Required your email address will not be publicly displayed.

Want to receive notifications when new comments are added? Login/Register for an account.

Time to take the Turing Test!!!

11 plus 9 equals
Type in the answer to the question you see above:

Your comment:

Sorry, no HTML allowed!