Not really a question, more of a "Wow, I never realised it made such a
difference" post but someone may find it useful.

For a long time now we've used ini files to store the basic configuration
settings for the CFCs in the application framework that we have built.
There's nothing wrong with them, they're just the job in fact and I didn't
really see a reason to change the framework to XML. Lately though, I've just
been getting that nagging feeling that I really should convert to using XML
because it offers much more flexibility in the way of organising the data
together with the fact that I can make the config files UTF-8 now.

Today I made the switch; I wrote a couple of functions to read in the ini
files, converting each of them into a structure and then serializing the
structure into a WDDX packet, saving it out as an XML file. I altered my
ReadProfileSection function to determine whether an XML file existed for
that CFC and load that rather than loading and parsing the ini file. 

Once I'd sorted out the logistics of it all, I got to the point where I
needed to re-initialise the application scope and test the re-load functions
using both the original ini files (for backwards compatibility) and then the
XML files for all future projects...

First time round, I used the ini files. I timed the object initialisation
section of code and it averaged out at 3700ms... Normal for the application.

The second attempt used the XML files that I'd converted earlier. The
application load was visibly quicker. It was so quick that I did it again
just to make sure it really was working. I set up the timer again for the
equivalent section of code and found that it took an average of 450ms to
reload the application scope vs the 3700ms it was taking when reading the
ini files. 

So, it turned out using XML instead of INI files returned a better than 8x
performance increase on the application initialisation and there all this
time, I thought it was simply the amount of objects I was caching in the
application scope...

AFAICT, the main reason for the performance increase is the manner in which
the config data is assigned to the variables.instance structure. With the
INI file, each value pair had to be read and parsed individually using
GetProfileString(). With the XML files either the whole or specific parts of
the XML can be directly deserialized into the variables.instance scope so
there is no extra processing, looping or any other jiggery pokery going on.

I know that this performance hit is only taken when an application restarts
but on our server we currently have in excess of 70 sites using this
framework so when the CF app restarts, we have a huge spike... This spike
should be much smaller as of now :)

Paul



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:258609
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to