Re: Lua Vector
Posted: Thu May 02, 2019 8:20 pm
Well it it does the same check 2 times so that should be removed. But I was referring to the fact that it generates new strings while calling asserts - there should be constant strings only (or an entirely different solution). It's not wrong to perform error checking because overhead is small, but for trivial operations like vector additions it constitutes a very significant fraction of overall performance. Given that it's something usually used in high volume, it adds up fast. With my own library, I would perform this check one time where performance isn't critical, and then put effort into writing code where such errors will never occur to begin with, so there would be no need to check against them on every single operation.