Writing cfquery inside cfoutput tag?

I am writing cfquery inside the cfoutput tag. It can be written outside the cfoutput tag. My question is here, do we have performance issues if we write cfquery inside cfoutput?

+4
source share
2 answers

In my experience, the fastest way for the server is that you only place <cfoutput></cfoutput> in areas containing variables, otherwise CF must scan everything inside the tags to see what it does and does not need to be translated for variables / functions.

Content overly wrapped in <cfoutput> also tends to create unwanted spaces that can affect documentation and downloads.

I donโ€™t know if there are any reliable performance tests with the latest versions of ColdFusion that confirm my opinion, and I want to note that for performance ColdFusion is certainly more important than <cfoutput> in the right place (for example, query caching, caching content, scope variables, etc.).

+5
source

In terms of true performance, if you use:

<cfoutput><cfquery>SELECT * FROM foo</cfquery>#now()#</cfoutput>

against

<cfquery>SELECT * FROM foo</cfquery><cfoutput>#now()#</cfoutput>

You will not see differences in performance.

However, you should REALLY look at the separation of DAO (or queries) from your views ...

+1
source

Source: https://habr.com/ru/post/1308728/


All Articles