Another developer I know created an old-fashioned form with many fields on the screen. In the cfml source code, it makes a lot of loops to generate the fields with their default value, a lot of calls to CFCs and others, generate the HTML and so on. At some point, Lucee generated this error:
There is too much code inside the template. Lucee was not able to break it into pieces, move parts of your code to an include or an external component/function
He got around it by reorganizing the code a bit, but I’m curious if there was another solution, like a special option in Lucee Admin like “Dude, try harder when you have a gigantic template to devour” or a tag to insert in the template.
It will not be possible to post the code here. My question was more theoretical, namely if Lucee limits the amount of code in a single template. It seems not only determined by the number of lines, but also by what’s happening in the code, like loops, number of variables…
I encountered a similar problem when working with Adobe Coldfusion. In fact, it’s more or less a problem in the sense that it’s up to the developer to better organize their code and not put everything in the same template. Except I was curious how Lucee determines that there is too much code in a single template. I’ll take a look to see if I can find this error message in the Lucee source code…
I would guess, and this is just a wild guess. if you put this on a massively fast ultra high memory version of tomcat you may never see this error, even if the template had lot of “work” on it.
something very low level such as max open files or max process threads consumed by file operations would come into play more than Lucee or Coldfusion just crashing.
Would be interesting to see how far up it goes and what code would trigger this.
Why would you not take on board the implied advice, and just… refactor yer code a bit?
If yer code is tipping those particular scales, it’s a sign the code could do with some attn, rather than Lucee needing to do anything differently.
At the end of the day, there’s an upper size limit on a compiled class; that comes from Java, not Lucee. Obvs the way Lucee transpiles the CFML into bytecode has impact on this, but I bet it’s about as efficient as Micha can make it.