bna08 Posted November 28, 2022 Report Posted November 28, 2022 (edited) I am using MoveBlock via Call Library Function to copy a few bytes. The duration of this call measured with two TickCount timestamps in a flat sequence around the call is about 40ms. Since MoveBlock should be similar to memcpy in C, I thought it would also perform similarly, however, if it's really this slow, I cannot use it in a meaninful way. Has anyone else measured its duration and can you confirm my findings? Edited November 28, 2022 by bna08 Quote
drjdpowell Posted November 28, 2022 Report Posted November 28, 2022 Move block is way faster than than that. Can you post an example VI showing how you are calling it? Quote
bna08 Posted November 28, 2022 Author Report Posted November 28, 2022 I agree it should be way faster. Here is my code snippet (pointer is just a constant number as an example, otherwise it points to an unmanaged array in my C++/CLI DLL). Quote
drjdpowell Posted November 28, 2022 Report Posted November 28, 2022 (edited) Your doing it in the UI thread (that would have been my number one guess). Switching threads is one of the few things that can be multi-millisecond expensive. Switch the Call to "any thread". Edit: actually, even a thread switch shouldn't take 40 milliseconds, but give it a try anyway. Edited November 28, 2022 by drjdpowell 1 Quote
Rolf Kalbermatter Posted December 1, 2022 Report Posted December 1, 2022 On 11/28/2022 at 5:57 PM, drjdpowell said: Edit: actually, even a thread switch shouldn't take 40 milliseconds, but give it a try anyway. The thread context switch itself to the UI thread and back again should and won't take that long, it's more in the tenths of microseconds. But that UI thread may be busy doing your front panel drawing or just about anything else that is UI related or needs to run in the only available single threaded protected context in LabVIEW and then the context switch to the UI thread has to arbitrate for it. And that means the LabVIEW code simply sits there and waits until the UI thread finally gets available again and can be acquired by this code clump. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.