ELIFE-ASU / Neet

Simulating and analyzing dynamical network models
https://neet.readthedocs.io/en/stable
Other
4 stars 10 forks source link

State encoding/decoding performance #127

Open dglmoore opened 5 years ago

dglmoore commented 5 years ago

Many of the analysis functions require converting states from lists to integers (encoding) and back (decoding). For example, in order to compute the attractors for a network integer states must be decoded, updated and then encoded again. Python can do this; but, being python, it's slow as sin. To deal with this we have two options:

C/C++ or Cython Implementation

We could implement these core functions in something C-like. The advantage of this is that it'll be very snappy. The disadvantage is, well, C/C++. That means distributing either a binary dependency or requiring the user to have a C/C++ compiler installed.

Network.update(int)

Alternatively, we can implement update methods that operate on integer encodings directly. That is, for example, if LogicNetwork.update receives a list the function behaves as it currently does; however, if it receives an integer it updates the bits of the integer according to the update rule. This saves encoding/decoding at the expense of a more complicated implementation.

hbsmith commented 5 years ago

Related to #154

dglmoore commented 5 years ago

@hbsmith I've been banging my head against this for a while now. I don't think there's a simple way to make this happen. Whatever we end up doing is going to take more time than we have before the next release. I propose we push this, #154 and #133 to the next release, possibly v1.1 or v1.2?