mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #5362] [MERGED] perf(xray): compile log/traffic regexps once at package scope #5857
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#5857
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5362
Author: @n0ctal
Created: 6/15/2026
Status: ✅ Merged
Merged: 6/20/2026
Merged by: @Mahyardana
Base:
main← Head:pr-0010-hoist-xray-regexps📝 Commits (2)
f325ec1perf(xray): compile log/traffic regexps once at package scope296f9f3Merge branch 'main' into pr-0010-hoist-xray-regexps📊 Changes
2 files changed (+15 additions, -7 deletions)
View changed files
📝
internal/xray/api.go(+7 -3)📝
internal/xray/log_writer.go(+8 -4)📄 Description
Summary
Compiles the log and traffic regexps once at package scope instead of on every call.
Why
GetTrafficrecompiled two stats regexps on every traffic-stats tick, andLogWriter.Writerecompiled two more on every log line — wasted work on hot paths.Scope
trafficRegex/clientTrafficRegexandcrashRegex/logLineRegexto package-level varsValidation
xraypackage tests passgo build/go vetcleanRisk
Low. Pure refactor — the regex patterns are unchanged.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.