Skip to content

RUM-16592: Remove regex usage in the MemoryVitalReader#3499

Merged
0xnm merged 1 commit into
developfrom
nogorodnikov/rum-16592/avoid-using-regex-in-memoryvitalreader
Jun 3, 2026
Merged

RUM-16592: Remove regex usage in the MemoryVitalReader#3499
0xnm merged 1 commit into
developfrom
nogorodnikov/rum-16592/avoid-using-regex-in-memoryvitalreader

Conversation

@0xnm

@0xnm 0xnm commented Jun 3, 2026

Copy link
Copy Markdown
Member

What does this PR do?

This PR removes regex usage in the MemoryVitalReader, see #3498 for the original suggestion.

The performance gain is ~4x (3364 ns/op before vs 814 ns/op after).

Note: it seems that Linux kernel always uses kB as a unit in the /proc/[pid]/status file.

https://github.com/torvalds/linux/blob/ba3e43a9e601636f5edb54e259a74f96ca3b8fd8/fs/proc/task_mmu.c#L65-L85

See also https://docs.kernel.org/filesystems/proc.html for the proc FS description.

Fixes #3498.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@datadog-official

This comment has been minimized.

jonathanmos
jonathanmos previously approved these changes Jun 3, 2026
@0xnm
0xnm force-pushed the nogorodnikov/rum-16592/avoid-using-regex-in-memoryvitalreader branch from 742e54e to 618fea2 Compare June 3, 2026 07:55
@0xnm
0xnm requested a review from jonathanmos June 3, 2026 07:55
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.18%. Comparing base (91882c1) to head (618fea2).

Files with missing lines Patch % Lines
...g/android/rum/internal/vitals/MemoryVitalReader.kt 20.00% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3499      +/-   ##
===========================================
- Coverage    72.23%   72.18%   -0.06%     
===========================================
  Files          965      965              
  Lines        35595    35596       +1     
  Branches      5932     5935       +3     
===========================================
- Hits         25712    25692      -20     
- Misses        8274     8286      +12     
- Partials      1609     1618       +9     
Files with missing lines Coverage Δ
...g/android/rum/internal/vitals/MemoryVitalReader.kt 60.00% <20.00%> (-18.57%) ⬇️

... and 35 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@0xnm
0xnm merged commit b2617b8 into develop Jun 3, 2026
27 checks passed
@0xnm
0xnm deleted the nogorodnikov/rum-16592/avoid-using-regex-in-memoryvitalreader branch June 3, 2026 08:55
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.

MemoryVitalReader allocating (and deallocating) unnecessary native ICU regex

3 participants