Closed federicofernandez closed 5 years ago
Sorry if I get the terminology wrong; I do not speak C++. Is this solution using dynamic dispatch? Does it make sense to move the inner loop into a separate function so that it can monomorphiz and inline the decay function?
Sorry if I get the terminology wrong; I do not speak C++. Is this solution using dynamic dispatch? Does it make sense to move the inner loop into a separate function so that it can monomorphiz and inline the decay function?
No, it won't be dynamic. The lambda function will be defined before the loop begins, so it is expected that the compiler will inline it in the inner loop.
Moving the inner loop into a separate function doesn't look beneficial for performance, but it's highly probable that the compiler will also inline it.
FYI, PR #112 fixed the problem that's causing this PR's Travis failures. If you merge develop
into this branch, the tests should pass.
FYI, PR #112 fixed the problem that's causing this PR's Travis failures. If you merge
develop
into this branch, the tests should pass.
Thanks @smmaurer! I did that and now tests are passing.
Just to be clear, this optimization should mainly impact the aggregate()
method of the Python API (https://github.com/UDST/pandana/blob/master/pandana/network.py#L274).
Part of the modifications from 0.3 to 0.4 included modifying the
decay
parameter from anenum
tostd::string
. That is a good modification in terms of functionality but it seems to be that it made the library slower.In this PR the comparisons are avoided by choosing a decay function before executing the loops. In my local environment, the performance improved (for the SEMCOG example) and it's very similar to
v0.3
.