XCLogParser icon indicating copy to clipboard operation
XCLogParser copied to clipboard

Replace Foundation scanner implementation

Open jrcmramos-bumble opened this issue 1 year ago • 3 comments

This PR fixes the issue #215.

The memory leak is not XCLogParser implementation related, but instead associated with the Scanner object while parsing considerable large files (tested with 243.3MB logs).

The initial attempt replaced Scanner with Substrings (please check commit history). Due to the poor runtime performance, mostly related with protocol witness calls to collection methods, we had to replace with a new Scanner component, implementing a subset of methods for our usages. This new implementation avoids invoking non performance String related methods.

Taking into account the above mentioned file, we were able to improve performance by around 80% compared to masters implementation

jrcmramos-bumble avatar Oct 20 '24 15:10 jrcmramos-bumble

@aleksandergrzyb this seems to be a promising PR, would you be able to pick this up?

AvdLee avatar Apr 17 '25 08:04 AvdLee

I've merged these changes locally and can see the performance improvements, but mostly the memory improvements 👌 Great work @jrcmramos-bumble!

AvdLee avatar Apr 17 '25 08:04 AvdLee

@aleksandergrzyb I updated the branch with one of @AvdLee suggestions. Would it be possible to reapprove it please? Thank you both!

jrcmramos-bumble avatar May 08 '25 09:05 jrcmramos-bumble