nit
nit copied to clipboard
lib/core: Pre-allocate at least 16 slots when enlarging array
This PR changes the way NativeArrays
are enlarged to avoid pre-allocating too much for small arrays.
This is the same kind of optimization as on FlatBuffer
for similar cases.
Is this based on objective and verifiable facts?
test this please I want to believe
missing sav to update http://gresil.org/jenkins/job/CI_github/4302/testReport/junit/tests.nitcs.test/new/test_new_native_alt1/
ping?
based on objective and verifiable facts
=> Not really, well, this does bring down the number of allocations in some programs, considering that the size allocated here is relatively small, I thought this could help to avoid allocating small arrays repeatedly.
However, is it the best minimum size, that I'm not sure.
I could run some tests on Nit programs to determine whether such a behaviour is preferable, maybe introduce a array_stat
or something (if it's not already here).
time on nitc/nitc/nitc is a good proof as it abuse arrays. You should also update some tests
test this please