Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Possible excess pre-allocation of memory #838

Closed
SohamTamba opened this issue Feb 12, 2018 · 2 comments
Closed

Possible excess pre-allocation of memory #838

SohamTamba opened this issue Feb 12, 2018 · 2 comments

Comments

@SohamTamba
Copy link
Contributor

https://github.com/JuliaGraphs/LightGraphs.jl/blob/9f6ce46dba133cde8330caeb90d4170d77cce268/src/spanningtrees/prim.jl#L25

Any connected tree contains | V | - 1 vertices, but this line of code pre-allocates a vector of length | E | to the mst vector. While it won't affect correctness or significantly slow speed, it seems to be unnecessary overhead to me.

@sbromberger
Copy link
Owner

This seems ripe for optimization. Mind filing a PR?

@SohamTamba
Copy link
Contributor Author

Sure, I'll get on it right away.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants