File tree 2 files changed +10
-5
lines changed
2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -16,18 +16,18 @@ let token_count = 0
16
16
next_token_id () = (token_count+= 1 )
17
17
end
18
18
19
- function data_size (d)
20
- Base. summarysize (d)
19
+ function approx_size (d)
20
+ Base. summarysize (d) # note: this is accurate but expensive
21
21
end
22
22
23
- function data_size (xs:: AbstractArray{String} )
23
+ function approx_size (xs:: AbstractArray{String} )
24
24
# doesn't check for redundant references, but
25
25
# really super fast in comparison to summarysize
26
26
sum (map (sizeof, xs))
27
27
end
28
28
29
29
function make_token (data)
30
- sz = data_size (data)
30
+ sz = approx_size (data)
31
31
tok = MemToken (myid (), next_token_id (), sz)
32
32
33
33
if ! isempty (freeable_lru)
Original file line number Diff line number Diff line change @@ -45,7 +45,12 @@ function affinity(t::Thunk)
45
45
end
46
46
end
47
47
end
48
- sort! (collect (aff), by= last,rev= true )
48
+ aff_vec = collect (aff)
49
+ if length (aff) > 1
50
+ sort! (aff_vec, by= last,rev= true )
51
+ else
52
+ aff_vec
53
+ end
49
54
end
50
55
51
56
function delayed (f; kwargs... )
You can’t perform that action at this time.
0 commit comments