3 ms·
> meaningfully slower really ? there's a difference but unless you keep allocating in a hot-loop this should hardly ever have observable costs : https://gcc.go
by jcelerier 8y ago
> meaningfully slower
really ? there's a difference but unless you keep allocating in a hot-loop this should hardly ever have observable costs : https://gcc.godbolt.org/z/SN9Ois https://gcc.godbolt.org/z/SN9Ois
- pjmlp 8y agoYes there is a talk done by Google at Linux Kernel Security Summit 2018 about it.
- jabl 8y agoThe problem is with how to access other variables on the stack. Usually the compiler uses an offset from the stack pointer, which without VLA's is known at compile time. However, if you have VLA's, you might need a calculation at runtime to figure out where that variable is stored. Or maybe the offset from the frame pointer is known statically, but then you can't do the "omit frame pointer" optimization and you thus waste a register. Or if you have a variable that is between two VLA's, then you need a runtime calculation regardless.