perf: eliminate redundant syscalls in "context.IsSet"#2283
perf: eliminate redundant syscalls in "context.IsSet"#2283lifubang wants to merge 1 commit intourfave:v1-maintfrom
Conversation
Signed-off-by: lifubang <lifubang@acmcoder.com>
yassinebenaid
left a comment
There was a problem hiding this comment.
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. |
So why |
|
@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 |
Thanks for the context -- I understand the situation. |
What type of PR is this?
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