⚡ Bolt: jointprob loop vectorization#289
Conversation
Reshapes the 1D probabilities array in jointprob directly to (trials, points) and uses np.sum(..., axis=1) instead of iterating over trials in a Python nested loop. This yields a ~1.73x speedup (~42% reduction in computation time) for jointprob. Co-authored-by: suraj-ranganath <14310165+suraj-ranganath@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Claude finished @suraj-ranganath's task in 2m 4s —— View job Code review — jointprob loop vectorization
Correctness ✅The vectorization in
So the mapping to BlockingNone. ImportantNone. Nits
Test gapsNone — the changed behavior is exercised by existing parity and workflow tests. EEGLAB parity notesNone — output values, thresholds, and |
💡 What:
Reshapes the 1D probabilities array in jointprob directly to
(trials, points)(i.e.,(arr.shape[2], arr.shape[1])) and usesnp.sum(..., axis=1)instead of iterating over trials in a nested Python loop.🎯 Why:
The inner loop of jointprob iterates over trials to perform log-sum-reductions. This nested looping and slicing introduces significant overhead when processing EEG data with many trials.
📊 Impact:
Provides a ~1.73x speedup (~42% reduction in computation time) for jointprob.
🔬 Measurement:
Verified with a temporary benchmarking script
tools/benchmark_jointprob.py(which has been cleaned up to keep the codebase tidy) and existing rejection workflow unit tests undertests/test_rejection_workflows.py.PR created automatically by Jules for task 13378537936914144045 started by @suraj-ranganath