Skip to main content
Participant
Oct 26, 2010 12:03 PM UTC
Answered

Heavy Constructor Warning

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 is closed to new replies. Start a new post to keep the conversation going.
Xavier AgnettiCorrect answer
Inspiring
Oct 26, 2010 2:30 PM UTC

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

2 replies

Xavier AgnettiCorrect answer
Inspiring
Oct 26, 2010 2:30 PM UTC

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

Translate
Participant
Oct 26, 2010 3:16 PM UTC

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

Translate