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

[WIP] Performance #3

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

noughtmare
Copy link

@noughtmare noughtmare commented Sep 14, 2019

Please test the performance of this.

Currently I've tried to optimize the receive function. I might look at send later.

The correctness should still be checked before this can be merged.

This pull request includes:

  • Adding inline pragmas to small functions
  • Using unsafe indexing (unsafeRxMap and unsafeRxGetMapping).
  • Remove the rxqDescriptor function from the RxQueue record and write it as a separate inlinable function.

Now the go loop inside the receive function uses unboxed operations almost exclusively, which means that no garbage gets generated. The only non-unboxed operations are due to IORefs. That might be a further opportunity for optimization. There is also allocation for the bufPtr that is consed to the bufs list, so using a mutable vector for that would probably also improve performance.

@eleksaggr
Copy link
Contributor

@emmericp

@TravisWhitaker
Copy link

Nice, this looks like it should do a bit better.

Would be good to change the GC parameters as well (at least a bigger -A and -H), as the GHC defaults are extremely conservative.

@noughtmare
Copy link
Author

I have made some more changes to make the code even more performant: noughtmare@2c24c5c. But that changes a lot about the code. It replaces all IOUArrays with unboxed vectors and uses unboxed IORefs instead of the standard boxed ones. And it uses a storable vector instead of the standard list for the send and receive functions. That makes the code uglier (there are ways to make it prettier again, but I didn't do that yet), so I haven't pushed it to this branch.

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.

3 participants