From 379e645c80fc8e628ee632cceb0939f2ac125718 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 12 May 2021 11:25:00 +0200 Subject: [PATCH] Replace arena allocator Use slab instead of the deprecated vec_arena, both of which appear to use the same Vec based storage of an enum that's either the entry or an index to the next free slot. --- sixtyfps_runtime/corelib/Cargo.toml | 2 +- sixtyfps_runtime/corelib/graphics.rs | 2 +- sixtyfps_runtime/corelib/timers.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sixtyfps_runtime/corelib/Cargo.toml b/sixtyfps_runtime/corelib/Cargo.toml index afbe175de..e07c49f6c 100644 --- a/sixtyfps_runtime/corelib/Cargo.toml +++ b/sixtyfps_runtime/corelib/Cargo.toml @@ -34,7 +34,7 @@ scoped-tls-hkt = "0.1" static_assertions = "1.1" strum = "0.20" strum_macros = "0.20" -vec-arena = "1.0.0" +slab = "0.4.3" pin-weak = "1" auto_enums = "0.7" stretch = "0.3.2" diff --git a/sixtyfps_runtime/corelib/graphics.rs b/sixtyfps_runtime/corelib/graphics.rs index cc4f19af9..aca590add 100644 --- a/sixtyfps_runtime/corelib/graphics.rs +++ b/sixtyfps_runtime/corelib/graphics.rs @@ -93,7 +93,7 @@ impl CachedGraphicsData { /// The RenderingCache, in combination with CachedGraphicsData, allows backends to store data that's either /// intensive to compute or has bad CPU locality. Backends typically keep a RenderingCache instance and use /// the item's cached_rendering_data() integer as index in the vec_arena::Arena. -pub type RenderingCache = vec_arena::Arena>; +pub type RenderingCache = slab::Slab>; /// FontRequest collects all the developer-configurable properties for fonts, such as family, weight, etc. /// It is submitted as a request to the platform font system (i.e. CoreText on macOS) and in exchange the diff --git a/sixtyfps_runtime/corelib/timers.rs b/sixtyfps_runtime/corelib/timers.rs index 0d537786a..f3dcb75bc 100644 --- a/sixtyfps_runtime/corelib/timers.rs +++ b/sixtyfps_runtime/corelib/timers.rs @@ -162,7 +162,7 @@ struct ActiveTimer { /// determining the nearest timeout. #[derive(Default)] pub struct TimerList { - timers: vec_arena::Arena, + timers: slab::Slab, active_timers: Vec, /// If a callback is currently running, this is the id of the currently running callback callback_active: Option,