dillon1000/react
Commit
Browse files [rust] Remove arena allocator
Using an arena allocator can be faster, but it comes with several challenges: * It requires tediously tagging nearly every value with a lifetime. Any function that has to deal with arena-allocated data (which is every meaningful function) ends up with a lifetime parameter. Bleh. We also have to thread the allocator itself wherever we need to allocate, though this is less of a problem since _most_ functions already need the Environment and we can store the allocator there. * There is not yet widespread support in the Rust ecosystem for using custom allocators with custom data types. This means that things like HashMap/Set and IndexMap/Set can't be arena allocated. This means that either we have to add support to these data types (by upstreaming or forking) or just accept that we're only partially using the arena allocator. * Finally, `bumpalo`'s `Box` cannot be moved out of, which turns out to be an annoying limitation that i've already had to work around several times. In the end i'm not sure arena allocators are worth it at this stage of the project. Relay Compiler has been successful without one, and other Rust-based internal compilers get by without them too.
Changed paths30 files
First-parent comparisoncompiler/forget/Cargo.lock ModifiedM compiler/forget/Cargo.toml ModifiedM compiler/forget/crates/forget_build_hir/Cargo.toml ModifiedM compiler/forget/crates/forget_build_hir/src/build.rs ModifiedM compiler/forget/crates/forget_build_hir/src/builder.rs ModifiedM compiler/forget/crates/forget_build_hir/src/context.rs ModifiedM compiler/forget/crates/forget_estree/Cargo.toml ModifiedM compiler/forget/crates/forget_estree/src/snapshots/[email protected] ModifiedM compiler/forget/crates/forget_fixtures/Cargo.toml ModifiedD compiler/forget/crates/forget_fixtures/tests/fixtures/jsx.js DeletedM compiler/forget/crates/forget_fixtures/tests/fixtures_test.rs ModifiedM compiler/forget/crates/forget_hir/Cargo.toml ModifiedM compiler/forget/crates/forget_hir/src/basic_block.rs ModifiedM compiler/forget/crates/forget_hir/src/environment.rs ModifiedM compiler/forget/crates/forget_hir/src/function.rs ModifiedM compiler/forget/crates/forget_hir/src/initialize.rs ModifiedM compiler/forget/crates/forget_hir/src/inline_use_memo.rs ModifiedM compiler/forget/crates/forget_hir/src/instruction.rs ModifiedM compiler/forget/crates/forget_hir/src/merge_consecutive_blocks.rs ModifiedM compiler/forget/crates/forget_hir/src/print.rs ModifiedM compiler/forget/crates/forget_hir/src/terminal.rs ModifiedM compiler/forget/crates/forget_optimization/Cargo.toml ModifiedM compiler/forget/crates/forget_optimization/src/constant_propagation.rs ModifiedM compiler/forget/crates/forget_ssa/Cargo.toml ModifiedM compiler/forget/crates/forget_ssa/src/eliminate_redundant_phis.rs ModifiedM compiler/forget/crates/forget_ssa/src/enter.rs ModifiedM compiler/forget/crates/forget_ssa/src/leave.rs ModifiedM compiler/forget/crates/forget_utils/Cargo.toml ModifiedM compiler/forget/crates/forget_utils/src/lib.rs ModifiedD compiler/forget/crates/forget_utils/src/retain_mut.rs DeletedPatch
Files changed
Rendering syntax-highlighted changes…