TArray<FVector2D> much slower than std::vector<FVector2D>?

I benchmarked the element access times between a TArray containing FVector2Ds and a std::vector array. TArray performs significantly slower here. I compiled using the default “Development Editor” settings in Visual C++ 19, UE4.22.3, Win7.
I tend to stick with UE4 libraries wherever possible due to compatibility, but why is it so slow?

Do you have logs ?

I think TArray is garbage collected. Might have something to do with it. Although just access you would think it wouldn’t. :frowning:

Also, by “slower” how much slower?

TArray does a bounds check in ] in non-shipping configs. You can skip this with GetData() if really necessary.

I can’t tell you exactly how much slower the array acces only is. I did a loop with some calcluations using values stored in arrays and random numbers to reduce the effect of caching and the TArray-loop took twice as long as std::vector.
Thanks Zeblote, accessing using GetData() makes it as fast as std::vector.