January 6, 2009

Pages


Search Site


Topics



Archives

Tweets

Improve Model-Glue 3 Load Time: Remove Unwanted Helpers

May 30 2008 by Adam
I've been spending a fair amount of time playing with the latest Release Candidate of Model-Glue 3 lately, and I've stumbled on a way to vastly improve load time. One of the new features of MG3 is "helpers", which is an easy way to make UDFs available throughout your applications. It really does make working with UDFs in Model-Glue easier, but there's one problem: It comes packaged with hundreds and hundreds of them. In fact – almost every single UDF on CFLib! And especially on your development server, where you're likely to reload the entire framework on every request loading them takes a good long time. If you prefer to hand-pick which UDFs to include – as I do – you have a couple of options. The simplest is to edit your config/coldspring.xml file, and remove the reference to the packaged helpers: <property name="helperMappings"><value>/helpers,/ModelGlue/helpers</value></property> becomes: <property name="helperMappings"><value>/helpers</value></property> Now you can selectively put UDFs that you want to use into your /helpers folder and have access to them without having to tack an extra 10 seconds onto the load of every page.

Posted in ColdFusion | Frameworks | Model-Glue |

5 comments:

  1. Raymond Camden Says:

    Fixed in source for the application template. Next time the zip is updated the XML will look just like yours Adam.
  2. Adam Says:

    Glad to be of help. I love Model-Glue and only hope that my tinkering proves useful in some minuscule way. :)

    Like I said earlier though, I think they serve as a good example of how to implement helpers; so I hope that you'll include ONE function -- helloWorld() or something of that ilk -- in the final release.
  3. Adam Says:

    @Ray, could be. This machine, in addition to running CF and all your normal user clutter (not a server), also runs SQL Server Express and some other stuff. Either way, unless they're being used, I'd say the inclusion of *all* of those functions is just unwanted clutter. Serves as a good example on implementation, but shouldn't be put into production that way.
  4. Joe Rinehart Says:

    Hey Adam,

    Raymond and I just talked - we're removing them from being included by default. They've caused all sorts of version conflicts, there's a lot of missed var scoping, etc....

    -Joe
  5. Raymond Camden Says:

    Awesome tip there. MG3 seems very quick for me though - even with reload on. I wonder if it's just my machine versus yours. Either way though - thanks for sharing this.

Comments now closed