Significant performance degradation when creating vector3 compared to tuple(float,float,float)

Summary

Creating a simple vector3 object is significantly slower than creating a tuple(float,float,float). This unexpected cost has major runtime impact when vector creation appears in tight loops.

Please select what you are reporting on:

Unreal Editor for Fortnite

What Type of Bug are you experiencing?

Verse

Steps to Reproduce

Call this every frame

Vector benchmark

for (i := 0..10000):
v := vector3{X := 1.0, Y := 2.0, Z :=3.0}

Tuple benchmark

for (i := 0..10000):
t := (i, i, i)

Expected Result

Both benchmarks should require approximately the same execution time.

Observed Result

Actually, the Vector3 benchmark causes the tick rate to drop to an average of 3 to 4 ticks per second. The tuple benchmark maintains a tick rate of about 30 ticks per second.

Platform(s)

Computer

Island Code

0532-3640-7380

Video

vector3:

tuple(float,float,float):