Karthik Swaminathan
Karthik Swaminathan

Reputation: 147

Does Application.cfc take more execution time than Application.cfm?

We are moving from Adobe ColdFusion 8 to 10. We have applications using Application.cfm. We decided to start using Application.cfc as it offers more customized approach. I was checking on how to convert Application.cfm to Application.cfc and noticed that Application.cfc with same amount of code as in Application.cfm takes more execution time than when using Application.cfm. For example if Application.cfm takes 150ms, Application.cfc takes 630ms. Is that how it is?

I did not go into any other detail. Please let me know if you need more details.

Thanks.

Upvotes: 1

Views: 160

Answers (1)

Kevin Morris
Kevin Morris

Reputation: 354

I have found application.cfc to run faster than application.cfm, but it's been years since I've used application.cfm. I would tend to agree with Adrian that it might be your code.

You can use getTickCount() to track how long sections of your code are taking to run.

The example below would track the runtime of the entire request. You would need to log or output the final value of local.loadTime. You can calculate the difference between a tickCount before and after any block of code to see how long it took to execute.

boolean function onRequestStart() {
    request.startTime = getTickCount();
    return true;
}

void function onRequestEnd() {
    if (structKeyExists(request, "startTime") && request.startTime > 0) {
        local.loadTime = getTickCount() - request.startTime;
    }
}

Upvotes: 1

Related Questions