Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

cfscript function vs cffunction

Guest
Sep 02, 2009 Sep 02, 2009

Just passing on something I ran across recently:  I have a page that has 2 nested CFLOOP's, and a UDF function call inside the inner loop.  The page was consistently taking about 75 seconds to run.  Just out of curiousity, I changed the UDF from a CFSCRIPT function to a CFFUNCTION, and the load time went from 75 seconds to less than 5.  At first I thought I broke it, and it was not really running, but it was I double-checked, and it was running properly and returning the same results.  Probably not significant if a function is called 1 or 2 times on a page, but if it's 100's or 1000's, it could be a big improvement.  This is CF8.

1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Sep 03, 2009 Sep 03, 2009

That is something difficicult to believe. Will it be possible for you to log a bug and post the repro case there?

http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 03, 2009 Sep 03, 2009

Can you post the code?

--

Adam

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 03, 2009 Sep 03, 2009

I was originally working on this a couple of months ago, but didn't have time to post this then due to a long vacation soon after that.  Since then the code has evolved, and I don't have an exact example to post.  But after thinking back, I believe the 2 nested CFLOOPs were actually inside a CFOUTPUT loop.  So with 3 nested loops, the function could have been executing 100,000 times (or more) on one page.  Even if just a fraction of a second improvement, this would be a major difference.  I'm guessing the CFFUNCTION somehow keeps itself instantiated memory, so that later calls are faster?

I have since done this translation to CFFUNCTION in other places with minor improvements, but these are being called many times fewer on a page.

Whenever comparing execution times, I do reload the original several times, and then reload the revised several times...  just to make sure the results are consistent and accurate.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 03, 2009 Sep 03, 2009

Fair enough.

One thing about your follow-up post concerns me - in an unrelated way - though:

the code has evolved, and I don't have an exact example to post.

This suggests to me that you are possibly not using source control on your code?  If not, you really really really should be.

http://subversion.tigris.org/

--

Adam

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 03, 2009 Sep 03, 2009
LATEST

Yes, I know.  This is an after-hours project on my home computer, and it hasn't caught up to versioning.  If it were at the office, it'd be different.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources