Skip to content

Optimize profiler runtime hot paths#6

Open
ServerlessApplicationRun wants to merge 1 commit intomasterfrom
cursor/optimize-hotspots-fd06
Open

Optimize profiler runtime hot paths#6
ServerlessApplicationRun wants to merge 1 commit intomasterfrom
cursor/optimize-hotspots-fd06

Conversation

@ServerlessApplicationRun
Copy link
Copy Markdown
Owner

@ServerlessApplicationRun ServerlessApplicationRun commented Apr 15, 2026

Summary

  • cache per-thread profiler state in Profiler so method entry no longer contends on the global threadProfile lock after first access
  • batch sampler output per sampling cycle and flush once instead of flushing once per thread
  • preserve the existing per-thread locking model while reducing lock contention and file I/O overhead

Testing

  • javac -cp src/main/java -d target/manual-classes src/main/java/com/taobao/profile/Profiler.java src/main/java/com/taobao/profile/thread/SamplerThread.java
  • java -version (environment uses OpenJDK 21; Maven is not installed in this cloud environment)
Open in Web Open in Cursor 

Co-authored-by: ServerlessApplicationRun <ServerlessApplicationRun@users.noreply.github.com>
@ServerlessApplicationRun ServerlessApplicationRun marked this pull request as ready for review April 15, 2026 14:59
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