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

Further SCP Performance Improvements #134

Open
1 of 7 tasks
mundya opened this issue May 3, 2015 · 2 comments
Open
1 of 7 tasks

Further SCP Performance Improvements #134

mundya opened this issue May 3, 2015 · 2 comments

Comments

@mundya
Copy link
Member

mundya commented May 3, 2015

It occurs to me that if SCP reads and writes used memoryviews much more internally it may be possible to extract further performance improvements.

  • Allow the data part of SDP and SCP packets to be a byte-formatted memoryview - ensure that bytes is called on it prior to creating a bytestring for the packet.
  • SCPConnection.write should accept a byte-formatted memoryview to write and should cast all other arguments into this type before constructing write packets.
    • MachineController.write should be documented appropriately, and perform memoryview.cast upon any received objects to ensure that they are in an appropriate format.
  • More controversially SCPConnection.read should be replaced with read_into which accepts, instead of a number of bytes, a byte-formatted memoryview to fill with data from the machine.
    • @mossblaser This will affect integration with project-rig/rig-scp - do you have any thoughts here? It may still be possible to use ctypes and return a pointer to a char array from a memoryview, but I'm not sure.
    • MachineController.read should work a currently, just modified to create a buffer to pass to read_into
    • MachineController.read_into should be added and should cast the memoryview it receives as appropriate.
  • In WIP Even faster SCP. #115 send_scp_burst should call callbacks with bytestrings/memoryviews RATHER than unpacked packets. This reduce the amount of needless unpacking in the case that none or only some of the SCP fields are used.
@mundya mundya added this to the 1.0 milestone May 3, 2015
@mundya
Copy link
Member Author

mundya commented May 3, 2015

NB, because Numpy supports the buffer protocol this should allow:

sdram.write(addr, memoryview(my_numpy_array))

and

sdram.read_into(addr, memoryview(my_numpy_array))  # kwarg for number of bytes, maybe

@mossblaser
Copy link
Member

Regarding rig-scp, as you'd expect, the "read" function is really "read-into": you supply a void-pointer into a block of memory to dump the read data into.

All this sounds rather good but I'd be tempted to postpone this until it is really necessary on the old KISS principle. After all, I think at the point where the small differences here make the difference, we're probably stuck anyway. Plus for non (0, 0) writes we're still massively I/O bound anyway. That said, don't let me block a weekend of fun ;).

@mundya mundya modified the milestone: 1.0 Mar 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants