Original Post
What exactly are inline functions, what''s the difference between normal functions and inline functions and why should i use them?
Thanks in advance !
quote:
Original post by NatasDM
The code is compiled inline with the rest of the section instead of jumping to a seperate point.
Let''s pretend you have a function called func1() and you call it inside a loop. Every iteration of that loop, your code copies the variables and jumps to a seperate section. This jumping and copying takes time, which slows down the function.
Now if the function is only a couple lines long, then it would be faster just to copy all of those lines inline where it''s called, saving a jump and optimally the copying.
The bad thing is, to speed up programs, some compilers "unroll" loops. Instead of unrolling a loop that produces 1000 jumps (let''s say) to a different section, it unrolls the 2 lines times 1000 ( = 2000). This is called code bloat.
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more