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

Added heapqueue collection. Fixed timers in asyncdispatch. #4122

Merged
merged 1 commit into from Apr 28, 2016

Conversation

yglukhov
Copy link
Member

Fixes #4120

@cheatfate
Copy link
Member

Do you made any benchmarks on your timers?

@yglukhov
Copy link
Member Author

@cheatfate, I can't see what to benchmark here. My small private tool that relies on intensive polling (check and sleep with adaptive (close to zero) timeout) shows 600 polls/sec, instead of 2-3 polls/sec as it was before the fix. Timer addition takes log n instead of 1, and timers processing is log n (close to 1 in reality) instead of n, timeout adjustment before polling (new functionality that fixes this bug) is 1. Basically this PR fixes a logic bug, it's not intended to change overall performance really.

# heap invariant.
proc siftdown[T](heap: var HeapQueue[T], startpos, p: int) =
var pos = p
var newitem = heap[pos]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

system.shallowCopy is faster than '=' for these things usually, where data is only moved around internally.

@dom96 dom96 merged commit d2b191d into nim-lang:devel Apr 28, 2016
@yglukhov yglukhov deleted the binheap branch May 26, 2016 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants