insights-core icon indicating copy to clipboard operation
insights-core copied to clipboard

ls parser speed improvements, reworked

Open PaulWay opened this issue 8 months ago • 1 comments

All Pull Requests:

Check all that apply:

  • [Y] Have you followed the guidelines in our Contributing document, including the instructions about commit messages?
  • [Y] No Sensitive Data in this change?
  • [N] Is this PR to correct an issue?
  • [Y] Is this PR an enhancement?

Complete Description of Additions/Changes:

This is an update for my previous ls parser speed improvements work, after the removal of 'raw_entry' by @xiangce.

Main speed improvements are:

  • Once the format of the directory has been found, use the same function to parse all lines in that directory.
  • In parsing subfunctions, put data directly into the dirent's dictionary.
  • Only parse name -> link if the dirent is actually a link.
  • Handle files first when adding to the files/dirs/specials lists.
  • Ignore obviously malformed lines.
  • Faster and easier to read logic for partly-formed directory listings with dirname not first line.

Readability improvements are:

  • Functions for name handling, SELinux context handling, major,minor/size/date handling.

PaulWay avatar Mar 31 '25 05:03 PaulWay

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 77.51%. Comparing base (05eb089) to head (c942700).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4408      +/-   ##
==========================================
+ Coverage   77.50%   77.51%   +0.01%     
==========================================
  Files         744      744              
  Lines       41574    41571       -3     
  Branches     6667     6665       -2     
==========================================
+ Hits        32220    32223       +3     
+ Misses       8319     8315       -4     
+ Partials     1035     1033       -2     
Flag Coverage Δ
unittests 77.50% <100.00%> (+0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-commenter avatar Mar 31 '25 05:03 codecov-commenter