Skip to content

Commit f7bdf66

Browse files
committed
Add a type assertion to remove some invalidations
This removes about 55 invalidations from Base._any(). Not sure why storage_read() fails to infer by itself, perhaps because it's using atomics?
1 parent ac520da commit f7bdf66

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/storage.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -879,8 +879,10 @@ function sra_migrate!(sra::SimpleRecencyAllocator, state::RefState, ref_id, to_m
879879
# and go to the "to" device. The passed-in ref is inserted into the
880880
# "from" device.
881881
if ismissing(to_mem)
882-
# Try to minimize reads/writes
883-
sstate = storage_read(state)
882+
# Try to minimize reads/writes. Note the type assertion to help the
883+
# compiler with inference, this removes some Base._any() invalidations.
884+
sstate::StorageState = storage_read(state)
885+
884886
if sstate.data !== nothing
885887
# Try to keep it in memory
886888
to_mem = true

0 commit comments

Comments
 (0)