Skip to content

Commit d22099d

Browse files
committed
Conn: updateSynapsePermanence micro-optimization
funny, one line moved 4 rows, and 5% performance :) write new permanence only if changed
1 parent 9250b39 commit d22099d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/htm/algorithms/Connections.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,11 @@ void Connections::updateSynapsePermanence(Synapse synapse,
268268

269269
const bool before = synData.permanence >= connectedThreshold_;
270270
const bool after = permanence >= connectedThreshold_;
271-
synData.permanence = permanence;
272-
273271
if( before == after ) { //no change
274272
return;
275273
}
274+
synData.permanence = permanence;
275+
276276
const auto &presyn = synData.presynapticCell;
277277
auto &potentialPresyn = potentialSynapsesForPresynapticCell_[presyn];
278278
auto &potentialPreseg = potentialSegmentsForPresynapticCell_[presyn];

0 commit comments

Comments
 (0)