Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from

Conversation

lbajolet
Copy link
Contributor

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.

@privat
Copy link
Member

privat commented May 12, 2016

Is this based on objective and verifiable facts?

@privat
Copy link
Member

privat commented May 13, 2016

test this please
I want to believe

@privat
Copy link
Member

privat commented May 13, 2016

@privat
Copy link
Member

privat commented May 17, 2016

ping?

@lbajolet
Copy link
Contributor Author

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

@privat
Copy link
Member

privat commented May 24, 2016

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

@privat
Copy link
Member

privat commented May 3, 2018

test this please

@privat privat closed this Aug 15, 2024
@privat privat reopened this Aug 15, 2024
Copy link

Test Results

    67 files     339 suites   17m 16s ⏱️
14 187 tests 13 640 ✅ 543 💤 0 ❌ 4 🔥
14 709 runs  14 147 ✅ 558 💤 0 ❌ 4 🔥

For more details on these errors, see this check.

Results for commit b8549ac.

@privat privat closed this Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants