nit icon indicating copy to clipboard operation
nit copied to clipboard

lib/core: Pre-allocate at least 16 slots when enlarging array

Open lbajolet opened this issue 8 years ago • 7 comments

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.

lbajolet avatar May 12 '16 19:05 lbajolet

Is this based on objective and verifiable facts?

privat avatar May 12 '16 20:05 privat

test this please I want to believe

privat avatar May 13 '16 00:05 privat

missing sav to update http://gresil.org/jenkins/job/CI_github/4302/testReport/junit/tests.nitcs.test/new/test_new_native_alt1/

privat avatar May 13 '16 02:05 privat

ping?

privat avatar May 17 '16 19:05 privat

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).

lbajolet avatar May 24 '16 14:05 lbajolet

time on nitc/nitc/nitc is a good proof as it abuse arrays. You should also update some tests

privat avatar May 24 '16 23:05 privat

test this please

privat avatar May 03 '18 23:05 privat