Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix https://github.com/swiftlang/swift-docc/issues/1066 #1067

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

icanzilb
Copy link
Contributor

Bug/issue #, if applicable: #1066

Summary

Folds sequential filter and first into a single filter(where:) to prevent the extra step.

Dependencies

n/a

Testing

The optimization only takes place when running on Linux with benchmarking enabled. I.e.:

DOCC_BENCHMARK=YES [further env variables] ./docc convert [further arguments]

There isn't a specific unit test covering the change as the behavior is unchanged.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • [n/a] Added tests
  • Ran the ./bin/test script and it succeeded
  • [n/a] Updated documentation if necessary

@icanzilb icanzilb changed the title Fixes https://github.com/swiftlang/swift-docc/issues/1066 Fix https://github.com/swiftlang/swift-docc/issues/1066 Oct 19, 2024
@icanzilb
Copy link
Contributor Author

@swift-ci Please smoke test

Copy link
Contributor

@d-ronnqvist d-ronnqvist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a fine change for code readability but it doesn't have any performance impact in practice since it's only applies to the lines that takes up 0.1% of the time to compute this peak memory metric on Linux.

Screenshot 2024-10-21 at 12 06 06

If we wanted to address the performance of this code we should avoid splitting all the lines (which is where ~80% of the time is spent) and find the "VmPeak" line in a way that avoids new allocations.

That said, this metric is only computed once during a full documentation build and doesn't even register in a profile so the performance of this function isn't a problem.

@icanzilb
Copy link
Contributor Author

@swift-ci please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants