Skip to content

Commit

Permalink
Merge pull request #83 from JamesWrigley/invalidation-fix
Browse files Browse the repository at this point in the history
Add a type assertion to remove some invalidations
  • Loading branch information
jpsamaroo authored Apr 3, 2024
2 parents 340d001 + f7bdf66 commit c49fe52
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/storage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -879,8 +879,10 @@ function sra_migrate!(sra::SimpleRecencyAllocator, state::RefState, ref_id, to_m
# and go to the "to" device. The passed-in ref is inserted into the
# "from" device.
if ismissing(to_mem)
# Try to minimize reads/writes
sstate = storage_read(state)
# Try to minimize reads/writes. Note the type assertion to help the
# compiler with inference, this removes some Base._any() invalidations.
sstate::StorageState = storage_read(state)

if sstate.data !== nothing
# Try to keep it in memory
to_mem = true
Expand Down

0 comments on commit c49fe52

Please sign in to comment.