Closed ayushi2103 closed 5 months ago
In which file should I add the unit test?
@swift-server-bot test this please
@ayushi2103 Can you update this PR since we just landed #299 which drops support for old Swift versions. This should mean you no longer have to add the conditional conformance.
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 theLogHandler
and updated thehandler
property to be computed, allowing transparent access to theLogHandler
.Result:
When the Logger instances will be passed around, the change will reduce memory overhead and potentially improve performance.