RTIInternational / virtual-opioid-user

Continuous model of an individual's opioid user over time
Other
1 stars 1 forks source link

Speed up model by improving compute_habit() #5

Closed sandypreiss closed 3 years ago

sandypreiss commented 3 years ago

After profiling the model, compute_habit() was the most prominent bottleneck.

By keeping a separate deque of concentration values that influence habit and its running sum, we avoid the two most prominent bottlenecks:

These improvements reduced average runtime from 4.7 to 0.6 seconds!