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

Peak memory metric on Linux could be slightly more performant #1066

Open
icanzilb opened this issue Oct 19, 2024 · 1 comment
Open

Peak memory metric on Linux could be slightly more performant #1066

icanzilb opened this issue Oct 19, 2024 · 1 comment
Labels
enhancement Improvements or enhancements to existing functionality

Comments

@icanzilb
Copy link
Contributor

icanzilb commented Oct 19, 2024

Feature Name

Slightly more optimal peak memory metric on Linux

Description

When I pulled DocC into our project our linter pointed me a small optimization in PeakMemory.swift, namely to fold a filter and first into first(where:) (Who knew swiftlint did that too?)

Motivation

It makes a micro-difference when running on an automation in a Linux image

Importance

A very low priority

Alternatives Considered

The only alternative I see is to leave the code as-is

@icanzilb icanzilb added the enhancement Improvements or enhancements to existing functionality label Oct 19, 2024
icanzilb added a commit to icanzilb/swift-docc that referenced this issue Oct 19, 2024
@d-ronnqvist
Copy link
Contributor

d-ronnqvist commented Oct 21, 2024

I think "micro difference" is overstating the impact of this 😉. The combined filter and first lines only take up 0.1 % of the time to compute this value.
Screenshot 2024-10-21 at 12 06 06

Like I said in this comment of the #1067 review:

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements or enhancements to existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants