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

Incorrect information regarding dynamic array reallocation frequency #9

Open
khisr0w opened this issue Aug 8, 2024 · 0 comments
Open

Comments

@khisr0w
Copy link

khisr0w commented Aug 8, 2024

In the array section of "Getting Started", it is mentioned that:
The above example works just fine, but involves 50 individual reallocations for no reason, since we already knew we were going to add 50 items.
Referring to a for loop 1..50 of array_add(arr, value).
This statement is incorrect, since in the current version of the compiler beta 0.1.092 there will only be 4 allocation for this routine, as shown below:
Size after each allocation: 0 -> 8 -> 16 -> 32 -> 64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant