Added CoW implementation for Logger struct to optimize performance and minimize memory overhead.
Motivation:
LogHandler is an existential type and has a String requiring two words so copying a Logger instance duplicates 7 words and executes two ARC operations. By implementing CoW with a boxed LogHandler, we will duplicate 1 word and one ARC operation, enhancing efficiency particularly when Logger instances are frequently passed around.
Modifications:
Added a private property _handler of type Box<LogHandler> to hold the LogHandler and updated the handler property to be computed, allowing transparent access to the LogHandler.
Result:
When the Logger instances will be passed around, the change will reduce memory overhead and potentially improve performance.
Added CoW implementation for Logger struct to optimize performance and minimize memory overhead.
Motivation:
LogHandler is an existential type and has a String requiring two words so copying a Logger instance duplicates 7 words and executes two ARC operations. By implementing CoW with a boxed LogHandler, we will duplicate 1 word and one ARC operation, enhancing efficiency particularly when Logger instances are frequently passed around.
Modifications:
Added a private property
_handler
of typeBox<LogHandler>
to hold the LogHandler and updated thehandler
property to be computed, allowing transparent access to the LogHandler.Result:
When the Logger instances will be passed around, the change will reduce memory overhead and potentially improve performance.