Skip to content

feat: add gperftools mise script#7063

Merged
LesnyRumcajs merged 1 commit into
mainfrom
gperftools-script
May 15, 2026
Merged

feat: add gperftools mise script#7063
LesnyRumcajs merged 1 commit into
mainfrom
gperftools-script

Conversation

@LesnyRumcajs
Copy link
Copy Markdown
Member

@LesnyRumcajs LesnyRumcajs commented May 15, 2026

Summary of changes

Make gperftools run not a hassle anymore

❯ mise run gperf:heap forest -- --encrypt-keystore=false --chain calibnet

Changes introduced in this pull request:

  • I think I was supposed to add this in the past as part of the mise migration but I forgot 😓

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Outside contributions

  • I have read and agree to the CONTRIBUTING document.
  • I have read and agree to the AI Policy document. I understand that failure to comply with the guidelines will lead to rejection of the pull request.

Summary by CodeRabbit

  • New Features

    • Added heap profiling capabilities with a new profiling script for performance analysis.
  • Chores

    • Updated profiling build configuration and build system dependencies.

Review Change Stack

@LesnyRumcajs LesnyRumcajs requested a review from a team as a code owner May 15, 2026 11:00
@LesnyRumcajs LesnyRumcajs requested review from hanabi1224 and sudo-shashank and removed request for a team May 15, 2026 11:00
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 2026

Walkthrough

This PR adds profiling infrastructure for gperftools-based memory heap analysis in Forest binaries. It adjusts the profiling profile optimization level, ensures the build script reruns on profiling configuration changes, and introduces a Bash utility script that orchestrates building and executing binaries under heap profiling collection.

Changes

Profiling Infrastructure

Layer / File(s) Summary
Profiling build configuration
Cargo.toml, build.rs
Profiling profile opt-level increases to 1 for better instrumentation balance, and build.rs triggers rebuild when FOREST_PROFILING_GPERFTOOLS_BUILD environment variable changes.
Heap profiling helper script
mise-tasks/gperf/heap.sh
New Bash script validates arguments, builds the target binary with gperftools enabled via FOREST_PROFILING_GPERFTOOLS_BUILD=1, extracts the executable path from cargo diagnostics, raises open-file limits, and executes the binary with HEAPPROFILE configured to /tmp/gperfheap.<bin>.prof.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • ChainSafe/forest#5837: Both PRs modify the same gperftools-based memory profiling setup by touching Cargo.toml's [profile.profiling] and adding/adjusting build.rs logic around FOREST_PROFILING_GPERFTOOLS_BUILD, aligning the build/profile tooling flow.

Suggested reviewers

  • hanabi1224
  • sudo-shashank
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add gperftools mise script' directly and specifically describes the main change: adding a new gperftools mise script for profiling. It is clear, concise, and accurately summarizes the primary modification.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch gperftools-script
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch gperftools-script

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@mise-tasks/gperf/heap.sh`:
- Line 36: The script currently calls ulimit -n 8192 in mise-tasks/gperf/heap.sh
which will cause the whole script to exit under set -e if the hard limit is
lower; change this to a best-effort attempt that does not hard-fail (e.g. run
the ulimit call in a conditional or append a fallback so failure only emits a
warning). Update the ulimit invocation (the "ulimit -n 8192" line) to check its
exit status and print a warning via echo or printf if it fails, but continue
execution (do not remove set -e).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3949e8e9-47c7-40e2-a3f6-ce9015981a35

📥 Commits

Reviewing files that changed from the base of the PR and between c89d3e3 and 02ab460.

📒 Files selected for processing (3)
  • Cargo.toml
  • build.rs
  • mise-tasks/gperf/heap.sh

Comment thread mise-tasks/gperf/heap.sh
@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.31%. Comparing base (c89d3e3) to head (02ab460).
✅ All tests successful. No failed tests found.

Additional details and impacted files

see 5 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c89d3e3...02ab460. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@LesnyRumcajs LesnyRumcajs enabled auto-merge May 15, 2026 12:02
@LesnyRumcajs LesnyRumcajs added this pull request to the merge queue May 15, 2026
Merged via the queue into main with commit ad9785d May 15, 2026
35 checks passed
@LesnyRumcajs LesnyRumcajs deleted the gperftools-script branch May 15, 2026 14:11
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.

2 participants