Skip to content

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Sep 9, 2025

Previously we had 2 different versions of AllocatorPool. Which version is used was controlled purely by the fixed_size / disable_fixed_size Cargo features.

Combine the 2 versions into a single AllocatorPool struct which can represent either a standard or a fixed-size allocator pool at runtime.

  1. AllocatorPool::new creates a pool which uses standard allocators.
  2. AllocatorPool::new_fixed_size creates a pool which uses fixed-size allocators.

AllocatorPool::new_fixed_size is feature-gated behind fixed_size Cargo feature.

Currently AllocatorPool::new still creates a fixed-size pool if fixed_size feature is enabled. That's just to avoid a change which would break the linter. Next PR will update the linter to conditionally use AllocatorPool::new_fixed_size, and then this workaround can be removed.

Copy link
Member Author

overlookmotel commented Sep 9, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 9, 2025

CodSpeed Instrumentation Performance Report

Merging #13622 will not alter performance

Comparing 09-09-refactor_allocator_pool_single_allocatorpool_implementation (a306c6f) with main (f9bff64)1

Summary

✅ 37 untouched benchmarks

Footnotes

  1. No successful run was found on main (99dd1a7) during the generation of this report, so f9bff64 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@overlookmotel overlookmotel marked this pull request as ready for review September 9, 2025 16:30
@graphite-app graphite-app bot force-pushed the 09-09-refactor_allocator_pool_share_allocatorguard_between_pool_impls branch from 7a28218 to fbeb154 Compare September 10, 2025 02:46
@graphite-app graphite-app bot force-pushed the 09-09-refactor_allocator_pool_single_allocatorpool_implementation branch from 308ef51 to 0285003 Compare September 10, 2025 02:47
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Sep 10, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Sep 10, 2025

Merge activity

Previously we had 2 different versions of `AllocatorPool`. Which version is used was controlled purely by the `fixed_size` / `disable_fixed_size` Cargo features.

Combine the 2 versions into a single `AllocatorPool` struct which can represent *either* a standard or a fixed-size allocator pool at runtime.

1. `AllocatorPool::new` creates a pool which uses standard allocators.
2. `AllocatorPool::new_fixed_size` creates a pool which uses fixed-size allocators.

`AllocatorPool::new_fixed_size` is feature-gated behind `fixed_size` Cargo feature.

Currently `AllocatorPool::new` still creates a fixed-size pool if `fixed_size` feature is enabled. That's just to avoid a change which would break the linter. Next PR will update the linter to conditionally use `AllocatorPool::new_fixed_size`, and then this workaround can be removed.
@overlookmotel
Copy link
Member Author

@camc314 has reviewed the top of this stack - where the changes to AllocatorPool are applied to linter. I don't think anyone else is in a particularly good position to review the changes to AllocatorPool itself, so am merging these few PRs without review.

@graphite-app graphite-app bot force-pushed the 09-09-refactor_allocator_pool_share_allocatorguard_between_pool_impls branch from fbeb154 to 99dd1a7 Compare September 10, 2025 04:04
@graphite-app graphite-app bot force-pushed the 09-09-refactor_allocator_pool_single_allocatorpool_implementation branch from 0285003 to a306c6f Compare September 10, 2025 04:04
graphite-app bot pushed a commit that referenced this pull request Sep 10, 2025
…ter` exists (#13623)

We're trying to move the linter away from relying on Cargo features to enable/disable support for JS plugins, and over to runtime options.

The signal that JS plugins are in use is the existence of an `ExternalLinter`.

Select what kind of `AllocatorPool` to use based on this criteria - fixed-size allocators if JS plugins are in use, or standard allocators otherwise. Utilize the `AllocatorPool::new_fixed_size` method added in #13622 to do this.
graphite-app bot pushed a commit that referenced this pull request Sep 10, 2025
… pool (#13624)

#13622 added `AllocatorPool::new_fixed_size` method to create a fixed-size allocator pool. #13623 switched the linter over to using this method when a fixed-size allocator is required. So now we can make `AllocatorPool::new` do what it's intended to do, and create a standard allocator pool.

Strictly speaking this is a breaking change, but I don't think anyone is using the `fixed_size` feature, except for the linter. Without that, this change makes no difference to behavior.
graphite-app bot pushed a commit that referenced this pull request Sep 10, 2025
…13625)

#13622 and #13624 altered what happens when the `fixed_size` Cargo feature is enabled. Previously, enabling that feature altered behavior of `AllocatorPool`. Now the feature is additive - it does nothing on it's own, but only adds additional APIs, and *those APIs* can be used to alter behavior.

The purpose of the `disable_fixed_size` Cargo feature was to prevent the `fixed_size` feature being activated when tests are run with `--all-features`. Now that enabling `fixed_size` feature doesn't alter behavior, we don't need to worry about it being enabled in tests. Therefore `disable_fixed_size` feature can be removed.

This removes a bunch of `#[cfg]` boilerplate, and ugly hacks which were previously required to workaround feature unification.
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Sep 10, 2025
Base automatically changed from 09-09-refactor_allocator_pool_share_allocatorguard_between_pool_impls to main September 10, 2025 04:11
@graphite-app graphite-app bot merged commit a306c6f into main Sep 10, 2025
30 checks passed
@graphite-app graphite-app bot deleted the 09-09-refactor_allocator_pool_single_allocatorpool_implementation branch September 10, 2025 04:12
graphite-app bot pushed a commit that referenced this pull request Sep 10, 2025
…ter` exists (#13623)

We're trying to move the linter away from relying on Cargo features to enable/disable support for JS plugins, and over to runtime options.

The signal that JS plugins are in use is the existence of an `ExternalLinter`.

Select what kind of `AllocatorPool` to use based on this criteria - fixed-size allocators if JS plugins are in use, or standard allocators otherwise. Utilize the `AllocatorPool::new_fixed_size` method added in #13622 to do this.
graphite-app bot pushed a commit that referenced this pull request Sep 10, 2025
… pool (#13624)

#13622 added `AllocatorPool::new_fixed_size` method to create a fixed-size allocator pool. #13623 switched the linter over to using this method when a fixed-size allocator is required. So now we can make `AllocatorPool::new` do what it's intended to do, and create a standard allocator pool.

Strictly speaking this is a breaking change, but I don't think anyone is using the `fixed_size` feature, except for the linter. Without that, this change makes no difference to behavior.
graphite-app bot pushed a commit that referenced this pull request Sep 10, 2025
…13625)

#13622 and #13624 altered what happens when the `fixed_size` Cargo feature is enabled. Previously, enabling that feature altered behavior of `AllocatorPool`. Now the feature is additive - it does nothing on it's own, but only adds additional APIs, and *those APIs* can be used to alter behavior.

The purpose of the `disable_fixed_size` Cargo feature was to prevent the `fixed_size` feature being activated when tests are run with `--all-features`. Now that enabling `fixed_size` feature doesn't alter behavior, we don't need to worry about it being enabled in tests. Therefore `disable_fixed_size` feature can be removed.

This removes a bunch of `#[cfg]` boilerplate, and ugly hacks which were previously required to workaround feature unification.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants