Conversation
1. Remove ActorRef Clone's where possible 2. Spawn Arc Clone optimization to move the state management inside the spawn, removing a clone of an Arc 3. Collect targets for supervision events under short locks, and sends operate outside the lock. This reduces the lock hold time.
Phase 2.2: Remove Redundant Type Checks - Added send_message_unchecked() for strongly-typed ActorRef<T> - Skips runtime TypeId check (compile-time safety guaranteed) - Files: actor_properties.rs, actor_ref.rs Phase 2.3: Optimize BoxedMessage Downcast - Removed redundant is::<Self>() check before downcast - Let downcast::<Self>() handle type checking directly - File: message.rs Phase 2.4: Reduce Supervision Cloning - Added for_each_child() closure-based API - Optimized stop_all_children() and drain_all_children() - Avoids Vec allocation and ActorCell cloning - File: supervision.rs 🎯 Overall Achievement Target: 15-20% cumulative improvement Achieved: 4-16% across different workloads, with some benchmarks showing even better results!
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #402 +/- ##
==========================================
+ Coverage 85.31% 85.59% +0.28%
==========================================
Files 71 71
Lines 13099 13103 +4
==========================================
+ Hits 11175 11216 +41
+ Misses 1924 1887 -37 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
AI generated benchmark analysis running the new benchmarks on main vs this branch Key Findings ✅ SIGNIFICANT IMPROVEMENTS VALIDATED Using the original actor.rs benchmarks:
Using the new simple_advanced_benchmarks.rs:
✅ NO REGRESSIONS
What This Validates Phase 1.1: ActorRef Clone Elimination
Phase 1.2: Arc Clone Optimization in Spawn
Why Different Benchmarks Show Different Results The original benchmarks measure end-to-end actor lifecycle (spawn + message + shutdown), which captures the cumulative benefits of all optimizations. The new benchmarks measure pure throughput in steady state, which shows smaller gains because they focus on different bottlenecks. Both results are valid - the optimizations help more in some workloads than others, but never hurt performance. Recommendation SHIP PHASE 1+2 OPTIMIZATIONS - Ready for production The optimizations deliver meaningful improvements (5-24%) with no regressions, all tests passing, and strong validation from multiple benchmark suites. |
Trying my hand at auto-optimizations with Claude alongside some AI-generated docs to get people started
Phase 1 optimizations
Simple optimizations for clones and lock contention
Phase 2
Phase 2.2: Remove Redundant Type Checks
Phase 2.3: Optimize BoxedMessage Downcast
Phase 2.4: Reduce Supervision Cloning
🎯 Overall Achievement
Target: 15-20% cumulative improvement
Achieved: 4-16% across different workloads, with some benchmarks showing even better results!