Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Improve get_connections performance #490
I found that GetConnections is quite slow and consumes unreasonable amount of memory. Quick investigation has shown that ConnectionManager::get_connections pre-allocates memory for all connections in the model even if user requests connections of a single node. It reserves space only for Token (16 bytes), but that become megabytes in large models. In addition the memory consumption is doubled by similar per-thread reservation. Obviously it also decreases the performance.
This PR improves get_connections by:
The simple test shows significant improvement of get_connection performance. It's about 118 times faster for requsting connections of a single source node. 55 times faster for a single target node. And 50% faster for requesting all connections (BTW, most time is spent outside c++ get_connection method).
The Python script measures average time of GetConnection call duration. It was run on my desktop with enabled OpenMP (16 threads).
Before integrating your code, we would need a signed contributor license agreement, which you can find at http://nest.github.io/nest-simulator/NEST_Contributor_Agreement.pdf . For more information, see towards the bottom of http://nest.github.io/nest-simulator/