I stumbled on a case in which I have a big number of scattered (i.e., generally non-consecutive) edge ids. If I wrap the selection in libsonata.Selection, the call for EdgePopulation.get_attribute(...) takes a significant amount of time.
For example, if I
edge_pop.get_attribute("afferent_section_id", libsonata.Selection(edge_ids))
the performance is significantly worse than doing:
edge_pop.get_attribute("afferent_section_id", edge_pop.select_all())[edge_ids]
There's a test case to demonstrate this effect in:
/gpfs/bbp.cscs.ch/project/proj30/home/herttuai/libsonata_sel_test/
It can be run with the run.sh. Example of the run output:
$ ./run_test.sh
Autoloading python/3.9.7
Autoloading hpe-mpi/2.25.hmpt
Running test...
number of total edge_ids 267023294
number of wanted edge ids: 2244619
length of selection ranges: 2231745
Duration, 'select_all and take edge_ids': 0.31s
Duration, 'Selection(edge_ids)': 30.92s
For smaller circuits, I guess doing select_all is not an issue, but for bigger ones, there might be concerns such as memory usage.