Could I save gas by using single statements instead of functions?

Hi! I have something to ask.
I am a newbie at smart contracts. Please help me.


This is portion of openzeppelin's ERC721Enumerable.sol.
If I use "_alltokens.length" instead of "ERC721Enumerable.totalSupply()" in "tokenByIndex" function, I would save gas. Am I right?

But why did they write like this?

(post deleted by author)