During the discussion of https://github.com/smarr/are-we-fast-yet/pull/84 the initialization strategy of Vector was discussed.
Before this PR, it would create an array of 50 elements in the default case.
This PR changes Vector to not create an array at the beginning, and instead initialize the storage with null. The access operations are adapted to check for null where needed and initialize the storage array on demand.
The size of the initial array is also decreased to 10. This choice is made mostly based on results from large program corpuses where people found that arrays tent to be small, usually have few elements. Though, I didn't investigate what the size distribution for our benchmarks here is.
During the discussion of https://github.com/smarr/are-we-fast-yet/pull/84 the initialization strategy of Vector was discussed. Before this PR, it would create an array of 50 elements in the default case.
This PR changes Vector to not create an array at the beginning, and instead initialize the
storage
withnull
. The access operations are adapted to check fornull
where needed and initialize thestorage
array on demand.The size of the initial array is also decreased to 10. This choice is made mostly based on results from large program corpuses where people found that arrays tent to be small, usually have few elements. Though, I didn't investigate what the size distribution for our benchmarks here is.
The PR also has a few other minor cleanups.