From f5567d2a84b944eea406262a8fecb9ddf5ee8908 Mon Sep 17 00:00:00 2001
From: thorstenhater <24411438+thorstenhater@users.noreply.github.com>
Date: Thu, 2 Apr 2020 20:02:15 +0200
Subject: [PATCH] Move q10 calculation to initialisation. (#999)

Pull out a constant computation from the update function to the initialisation step in the HH mechanism. In the busyring benchmark with hh/pas swapped this results in an overall speed-up
of roughly 20%.
---
 mechanisms/mod/hh.mod | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/mechanisms/mod/hh.mod b/mechanisms/mod/hh.mod
index 3e7a145c..8f380f83 100644
--- a/mechanisms/mod/hh.mod
+++ b/mechanisms/mod/hh.mod
@@ -35,6 +35,7 @@ ASSIGNED {
     mtau (ms)
     htau (ms)
     ntau (ms)
+    q10
 }
 
 BREAKPOINT {
@@ -47,24 +48,23 @@ BREAKPOINT {
 }
 
 INITIAL {
-    rates(v, celsius)
+    q10 = 3^((celsius - 6.3)/10)
+    rates(v)
     m = minf
     h = hinf
     n = ninf
 }
 
 DERIVATIVE states {
-    rates(v, celsius)
+    rates(v)
     m' = (minf-m)/mtau
     h' = (hinf-h)/htau
     n' = (ninf-n)/ntau
 }
 
-PROCEDURE rates(v, celsius)
+PROCEDURE rates(v)
 {
-    LOCAL  alpha, beta, sum, q10
-
-    q10 = 3^((celsius - 6.3)/10)
+    LOCAL  alpha, beta, sum
 
     :"m" sodium activation system
     alpha = .1 * vtrap(-(v+40),10)
-- 
GitLab