Skip to content

perf: eliminate redundant syscalls in "context.IsSet"#2283

Open
lifubang wants to merge 1 commit intourfave:v1-maintfrom
acmcode:fix-empty-syscall
Open

perf: eliminate redundant syscalls in "context.IsSet"#2283
lifubang wants to merge 1 commit intourfave:v1-maintfrom
acmcode:fix-empty-syscall

Conversation

@lifubang
Copy link

@lifubang lifubang commented Mar 16, 2026

What type of PR is this?

  • bug

What this PR does / why we need it:

The lack of an empty check before performing a syscall results in numerous redundant system calls within context.IsSet.

Which issue(s) this PR fixes:

Fix #2282

Signed-off-by: lifubang <lifubang@acmcoder.com>
@lifubang lifubang requested a review from a team as a code owner March 16, 2026 15:16
Copy link
Member

@yassinebenaid yassinebenaid left a comment

Choose a reason for hiding this comment

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

Not sure if it's worth it though

@lifubang
Copy link
Author

Not sure if it's worth it though

You're right -- the program runs for only tens of milliseconds and performs just ~10 such calls, so the direct performance or CPU cost is negligible. That said, these invalid syscalls still signal a logic flaw (e.g., passing an empty path), which can hurt observability by adding noise to logs, traces, and debugging tools like strace or auditd. They also represent unnecessary resource usage, however small—which adds up in aggregate across many invocations (e.g., in serverless, CI, or containerized environments). Fixing it improves code clarity, maintainability, and system hygiene with minimal effort.

@abitrolly
Copy link
Contributor

a logic flaw (e.g., passing an empty path),

So why eachName passes the empty path?

@dearchap
Copy link
Contributor

@lifubang v1 is in maintenance mode with only security fixes and nothing else. So is v2. v3 is the latest release. if you'd like to port this to v3 I'm fine with reviewing and merging

@lifubang
Copy link
Author

v1 is in maintenance mode with only security fixes and nothing else.

Thanks for the context -- I understand the situation.
Let me give it a try to upgrade urfave/cli from v1 to v3 in runc.
It’s likely a sizable effort, but worth doing.

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.

4 participants