From 49940ad5991297a403b84562771dd6e9a56f6f7c Mon Sep 17 00:00:00 2001 From: Brian Heim Date: Wed, 18 Dec 2019 18:20:41 -0600 Subject: [PATCH] SC: speedup readback (~3% speedup for gain.scd --- src/SuperColliderEngine.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/SuperColliderEngine.cpp b/src/SuperColliderEngine.cpp index 67a84b4..9ada2be 100644 --- a/src/SuperColliderEngine.cpp +++ b/src/SuperColliderEngine.cpp @@ -260,9 +260,8 @@ bool SC_VcvPrototypeClient::copyArrayOfFloatArrays(const PyrSlot& inSlot, const return false; } - const auto subContext = std::string(context) + " subarray"; for (int i = 0; i < NUM_ROWS; ++i) { - if (!copyFloatArray(inObj->slots[i], subContext.c_str(), outArray[i], size)) { + if (!copyFloatArray(inObj->slots[i], "subarray", outArray[i], size)) { return false; } } @@ -284,10 +283,7 @@ bool SC_VcvPrototypeClient::copyFloatArray(const PyrSlot& inSlot, const char* co auto* floatArray = reinterpret_cast(floatArrayObj); auto* rawArray = static_cast(floatArray->f); - for (int i = 0; i < size; ++i) { - outArray[i] = rawArray[i]; - } - + std::memcpy(outArray, rawArray, size * sizeof(float)); return true; }