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

Replace CVECTOR_LOGARITHMIC_GROWTH with CVECTOR_LINEAR_GROWTH #77

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

smlavine
Copy link
Contributor

In my own usage and in the examples I can find with using this library, it is more common to want to use the logarithmic growth algorithm than the linear growth algorithm. This is also the default (or only option) with vector and dynamic array data structures that are available in other programming languages. Setting the logarithmic algorithm to the default will reduce the burden on library users to define a special value in each compilation unit they use the library, and reduce the risk that they will forget to define it and lose performance.

This change is backwards compatible with any existing programs that defined the CVECTOR_LOGARITHMIC_GROWTH value; their program will continue to operate as intended, and they can remove the definition if/when they want.

This change will modify the behavior of programs that did not define the CVECTOR_LOGARITHMIC_GROWTH value; they must update their program to define the new CVECTOR_LINEAR_GROWTH value instead. However, given the small size of this library, I suspect that most users vendor the code directly into their codebases and will therefore not see any unexpected behavior. This change will only effect those that manually update their repository.

In my own usage and in the examples I can find with using this library,
it is more common to want to use the logarithmic growth algorithm than
the linear growth algorithm. This is also the default (or only option)
with vector and dynamic array data structures that are available in
other programming languages. Setting the logarithmic algorithm to the
default will reduce the burden on library users to define a special
value in each compilation unit they use the library, and reduce the risk
that they will forget to define it and lose performance.

This change is backwards compatible with any existing programs that
defined the CVECTOR_LOGARITHMIC_GROWTH value; their program will
continue to operate as intended, and they can remove the definition
if/when they want.

This change /will/ modify the behavior of programs that did not define
the CVECTOR_LOGARITHMIC_GROWTH value; they must update their program to
define the new CVECTOR_LINEAR_GROWTH value instead.
@eteran
Copy link
Owner

eteran commented Feb 13, 2025

Seems sensible enough to me.

@eteran eteran merged commit 296c2ee into eteran:master Feb 13, 2025
5 checks passed
@smlavine smlavine deleted the switch-logarithmic-to-linear branch February 14, 2025 00:07
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

Successfully merging this pull request may close these issues.

2 participants