Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vectorize temporal superposition #30

Merged
merged 8 commits into from
May 16, 2021
Merged

Conversation

j-c-cook
Copy link
Owner

@j-c-cook j-c-cook commented May 14, 2021

The temporal_superposition function is the primary bottleneck holding back cpgfunction from leaving pygfunction in the dust as far as a comparison of speed goes. The function needs vectorized so the time to solve the problem does not grow so heavily as the size of the problem becomes larger.

j_c_cook added 6 commits May 14, 2021 16:42
related to #15

The biggest problem with the code right now appears to be the
containers not all being 1D.

I propose creating an "ideal" temporal super position function
and performing timing tests on that to compare to what originally
existed.
@j-c-cook
Copy link
Owner Author

j-c-cook commented May 15, 2021

Commit fcc6ab5 provides a significant performance improvement.

The table from #14 (comment) is recreated comparing timings of the tests for the most recent release (v1.0.0) to the new code in this branch. The result appears to be about a 2x increase on average. The similarity identification still being a bottleneck.

|                       | cpgfcuntion v1.0.0 (s) | cpgfunction vx.x.x (s) | v1.0.0/vx.x.x |
|:---------------------:|:----------------------:|:----------------------:|:-------------:|
|       Rectangle       |          17.71         |          9.08          |      1.95     |
|     Open Rectangle    |          4.73          |          2.52          |      1.88     |
|           U           |          4.03          |          1.83          |      2.20     |
|           L           |          2.41          |          1.42          |      1.70     |
| custom (Poisson Disk) |          25.51         |          16.38         |      1.56     |

This implementation assumes all segments lengths are the same. They are, and may always be, but this should be taken into consideration. It will be possible to consider differing segment lengths in the future, but now and possibly the merge of this branch will create a new issue.

There is still quite a bit of work to be done along this line, so the speed improvements will be more in the future of this branch.

The temporal superposition function has been made final by creating the
desired 1D vectors beforehand and passing them in. This brings about
some unnecessary overhead and memory consumption that will be addressed
in the near future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant