Conversation
…se marker scanning Co-authored-by: simonge <5457667+simonge@users.noreply.github.com> Agent-Logs-Url: https://github.com/simonge/AcquPy/sessions/8ea991c6-e373-4261-8041-56699093856d
Co-authored-by: simonge <5457667+simonge@users.noreply.github.com> Agent-Logs-Url: https://github.com/simonge/AcquPy/sessions/8ea991c6-e373-4261-8041-56699093856d
Copilot created this pull request from a session on behalf of
simonge
September 3, 2026 14:59
View session
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
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.
Python processes AcquDAQ events orders of magnitude slower than C++ largely because
np.delete(arr, [])was called three times per clean event (allocating three full copies of the event array for nothing), and per-event helper functions used Pythonforloops withlist += range(…)to build index arrays.Key changes
Acqu.py— skip copies when there is nothing to deleteSame guard applied to EPICS and error indices. Also moves the error-path
np.deleteinside the early-return branch so the copy is only paid when the event is being discarded. ~6× speedup on the hot path (no special markers).Also replaces
np.append([1], …)withnp.concatenate(([1], …))inrunFunctionto avoid an extra intermediate allocation per buffer.Mk1Format.py/Mk2Format.py— vectoriseCheckErrorsandFillScalerArrayReplace
for … : list += range(…)with NumPy broadcasting and a fully-vectorised ragged-range built fromnp.repeat+np.cumsum:Mk2Format.py—FillEPICSArraytype consistencyReplaces per-buffer
epicsIndices += range(…)withappend(np.arange(…))+ a singlenp.concatenateat the end. Empty result now returnsnp.array([], dtype=np.intp)instead of[]so callers always receive a NumPy array.