Skip to main content
Participant
October 26, 2010
Answered

Heavy Constructor Warning

  • October 26, 2010
  • 1 reply
  • 1036 views

Hi there,

I can see it's a good principle to not have heavy constructors. But does anyone know if this the message about the compiler not compiling constructors is actually true?

"HeavyConstructor. Constructor must be as lightweight as possible. No control statement allowed, whereas a cyclomatic complexe of 2 has been detected. The Just-In-Time compiler does not compile constructors. Make them as lightweight as possible, or move the complexity of the code to a method called by the constructor. Then the complexity will be compiled by the JIT"

Thanks,

Justin

This topic has been closed for replies.
Correct answer Xavier Agnetti

Hi Justin,

Here is a white paper from Joa:

http://www.google.com/url?sa=t&source=web&cd=3&ved=0CB0QFjAC&url=http%3A%2F%2Fje2050.joa-ebert.com%2Ffiles%2Fmisc%2Fas3opt.pdf&rct=j&q=flash%20player%20constructor%20jit&ei=8eTGTOjeEIjUtQOe4uTNDQ&usg=AFQjCNE5td-Jv8iUuYVY3cLlY1zBc3SU6Q&sig2=qE3PN3SnBJauVDC4ZMUt2Q&cad=rja

Chapter 4.4

Cheers,

Xavier

1 reply

Xavier AgnettiCorrect answer
Adobe Employee
October 26, 2010

Hi Justin,

Here is a white paper from Joa:

http://www.google.com/url?sa=t&source=web&cd=3&ved=0CB0QFjAC&url=http%3A%2F%2Fje2050.joa-ebert.com%2Ffiles%2Fmisc%2Fas3opt.pdf&rct=j&q=flash%20player%20constructor%20jit&ei=8eTGTOjeEIjUtQOe4uTNDQ&usg=AFQjCNE5td-Jv8iUuYVY3cLlY1zBc3SU6Q&sig2=qE3PN3SnBJauVDC4ZMUt2Q&cad=rja

Chapter 4.4

Cheers,

Xavier

Participant
October 26, 2010

Hi Xavier,

Thanks. Very interesting. The ActionScript JIT compiler doesn't optimise code within constructors. Perhaps change the warning message to say "does not optimise code in constructors" rather than "does not compile constructors"?

Thanks,

Justin