GMS 2.3+ gml_pragma("forceinline") per script or per function in 2.3?

TsukaYuriko

šŸŒ 
Forum Staff
Moderator
The manual states (emphasis mine):
When the function is called with the "forceinline" pragma in a script function, the YYC will compile the project with the function inline, rather than referenced.
 

Tornado

Member
I'm still confused in GMS 2.3.x where to put
gml_pragma("forceinline");
At the beginning of the script or inside the function at the beginning of the function?
 

Tornado

Member
I had a problem with understanding that sentence from the manual. (maybe because I'm not English native)

I tried to test this. First I wanted to peek into the generated .cpp and .o files, but I somehow couldn't really get a clue from that.
Then I just created a test project which called a function 100 times (function contains 100 lines) and built different .apks and compared the sizes of apks:
1603042107153.png

The first apk is much bigger, so I guess that is where inline-ing happend.
Apparently this is the way to go:
1603042311766.png

Having "forceinline" outside of function doesn't do anything, I guess, because it generates the same apk size like when having no "forceinline" at all.

Sorry if it was obvious!

But why bulding with "forceinline"takes SO MUCH longer? Why this is so difficult for compiler/linker ???
A build with "inline" took around 7 minutes, while the other two were built almost instantly! (all builds were Android yyc)
 
Last edited:

Tornado

Member
Thank you for the link! I read it. Still don't understand what is the big deal.
But that's ok, it is apparently beyond my comprehension.
I just wondered, because instant build vs 7 minutes build is a hell of a differerence. (on Intel Core i7-9700KF @ 3.6GHz)

Thank you once again!
 
Top