VBA Compiler - Dynamic Array Slow


#1

Hello,
I’m trying to compile a portion of my code that uses dynamic arrays. To do that I make use of the function VarArrayCreate. However, my issue is that the function is extremly slow. This issue was already raised in this topic (from 2017).
So, is there any alternaive to VarArrayCreate in order to hadle dynamic arrays in the XLSPADLOCK vba Compiler?
Thank you


#2

Right now, no, we didn’t upgrade dynamic array support in the compiler. It’s on the TODO list though. There is a problem because we use variants and they are slow. However, there is no good replacement for them.


#3

I see. That’s a shame because it’s a real show-stopper for me.
And what about fixed size arrays? Does the compiler handle the creation of such arrays ? Because i tried the following with no success:
Dim tmp(1 to 3) as Variant
Dim tmp[1 to 3] as Variant


#4

You can keep operations on dynamic arrays in your normal VBA project.
Static arrays are explained in the guide: