in reply to using local and pass by reference method

It might be that using local is more effective than passing by reference (but I'm almost certain it isn't, but you could benchmark that), but that use of local is evil.

Seeing local is a flag, it says something about what you are doing, and that something is not supposed to be effective, but conseptually rather to temporarily alter a global/wider scope resource, with a promise to restore it when you go out of scope and without affecting others using it elsewhere.

hth