@@ -310,30 +310,11 @@ pub struct ResolveRawVcFuture {
310310 strongly_consistent : bool ,
311311 listener : Option < EventListener > ,
312312 /// `Arc<dyn TurboTasksApi>` for the turbo-tasks scope this future was constructed in.
313- ///
314- /// Polling this future is on a hot path. Without this cache, each poll would call
315- /// `with_turbo_tasks(...)` (a `LocalKey::with` access on the `TURBO_TASKS` thread-local),
316- /// which showed up in profiles even though each `LocalKey::with` call is individually
317- /// cheap. We capture at construction rather than on first poll to avoid the
318- /// `Option<...>` branch on the hot path. The future is always constructed inside a
319- /// turbo-tasks scope (via `RawVc::resolve` / `RawVc::into_read`) and cannot legally
320- /// migrate between scopes, so the captured value is valid for the future's lifetime.
321313 tt : Arc < dyn TurboTasksApi > ,
322314 /// Cached `Arc<RwLock<CurrentTaskState>>` for resolving `RawVc::LocalOutput` without going
323- /// through `CURRENT_TASK_STATE.with(...)` on every poll.
324- ///
325- /// `foo(bar).await` patterns produce `RawVc::LocalOutput` values that this future polls
326- /// repeatedly until ready. Each previous poll did a `LocalKey::with` on `CURRENT_TASK_STATE`
327- /// inside the `try_read_local_output` trait method. The state `Arc` does not change across
328- /// polls of the same future, so we cache it lazily on first use — many futures never hit a
329- /// `LocalOutput` so we don't want to pay the lookup eagerly.
330- ///
331- /// TODO: in the steady state we only need to access this **at most twice** per future
332- /// (once to fetch the listener, once to read the resolved value). Restructuring
333- /// `try_read_local_output` to return its own future — owning the listener internally
334- /// and yielding the value when ready — would let us drop this cache entirely. Today
335- /// the listener pattern forces a re-poll dance on the caller, so we cache the `Arc` to
336- /// keep that re-entry cheap.
315+ /// through `CURRENT_TASK_STATE.with(...)` on every poll. We should only ever poll local task
316+ /// state at most twice assuming the event listener mechanism works. so this field saves us
317+ /// one task local touch.
337318 cts : Option < Arc < RwLock < CurrentTaskState > > > ,
338319}
339320
@@ -465,9 +446,6 @@ pub struct ReadRawVcFuture {
465446
466447impl ReadRawVcFuture {
467448 pub ( crate ) fn new ( vc : RawVc ) -> Self {
468- // Capture `Arc<dyn TurboTasksApi>` once at construction; the inner
469- // `ResolveRawVcFuture` borrows it from `self.resolve.tt` for both phase 1 and
470- // phase 2 polls. One `LocalKey::with` for the lifetime of both phases.
471449 ReadRawVcFuture {
472450 resolve : ResolveRawVcFuture :: new ( vc) ,
473451 read_cell_options : ReadCellOptions :: default ( ) ,
0 commit comments