-
Notifications
You must be signed in to change notification settings - Fork 65
ShortestPath memory improvement #8
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
Open
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thanks for the patch! I really appreciate it. Unfortunately, I'm really
busy right now but I will take a look in a month or so. Also, the
ShorthestPath function traverses the whole graph, even when not needed.
I've been meaning to fix this for a long time. :)
Best regards,
Stefan
... On Sun, Sep 13, 2020 at 8:40 AM Rodrigo Schio ***@***.***> wrote:
Hi Korthaj, when i was using the ShortestPath function i noticed that it
was using a significant amount of memory (I was processing a large graph).
It seems that the closure is allocated (or a pointer to it) at each
iteration of the loop which makes the function use more memory.
name old time/op new time/op delta
ShortestPaths-8 154μs ± 0% 85μs ± 0% -45.02%
name old alloc/op new alloc/op delta
ShortestPaths-8 81.0kB ± 0% 41.1kB ± 0% -49.26%
name old allocs/op new allocs/op delta
ShortestPaths-8 849 ± 0% 17 ± 0% -98.00%
This package and your blog are awsome.
-Rodrigo
------------------------------
You can view, comment on, or merge this pull request online at:
#8
Commit Summary
- memory improvement
File Changes
- *M* path.go
<https://github.com/yourbasic/graph/pull/8/files#diff-167fa3abc5af405dd53a00a09a35b800>
(43)
Patch Links:
- https://github.com/yourbasic/graph/pull/8.patch
- https://github.com/yourbasic/graph/pull/8.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#8>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACVN3S3WZD6TE3QQQGEC7KTSFRSNNANCNFSM4RKPLHCA>
.
No problem, thank you.
marco-m
commented
Jun 5, 2021
Yeah, it's about time. It seems I'm a few years behind. In fact, I just
updated my Go version from 1.12 to 1.16...
Thanks a lot @rschio <https://github.com/rschio>. It really is a nice patch
with huge improvements to both time and memory. In a perfect world, the
compiler and runtime would do this automatically. But since it hasn't
happened yet, it probably never will. I suspect there are several other
algorithms in this package where a similar optimization would help. I'll
take a look.
... On Sat, Jun 5, 2021 at 1:53 PM Marco Molteni ***@***.***> wrote:
Hello @korthaj <https://github.com/korthaj>, would you have time now to
look at this PR? It looks promising.
As @rschio <https://github.com/rschio>, I do enjoy your blog and this
module :-)
thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACVN3SY2HSIZ5A4JY6UC2A3TRIF3JANCNFSM4RKPLHCA>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Korthaj, when i was using the ShortestPath function i noticed that it was using a significant amount of memory (I was processing a large graph).
It seems that the closure is allocated (or a pointer to it) at each iteration of the loop which makes the function use more memory.
This package and your blog are awsome.
-Rodrigo