Skip to content

Commit a5c8fd1

Browse files
author
Shashi Gowda
committed
rename data_size to approx_size, add fastpath to Thunk affinity
1 parent 107e4f1 commit a5c8fd1

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

Diff for: src/lib/dumbref.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ let token_count = 0
1616
next_token_id() = (token_count+=1)
1717
end
1818

19-
function data_size(d)
20-
Base.summarysize(d)
19+
function approx_size(d)
20+
Base.summarysize(d) # note: this is accurate but expensive
2121
end
2222

23-
function data_size(xs::AbstractArray{String})
23+
function approx_size(xs::AbstractArray{String})
2424
# doesn't check for redundant references, but
2525
# really super fast in comparison to summarysize
2626
sum(map(sizeof, xs))
2727
end
2828

2929
function make_token(data)
30-
sz = data_size(data)
30+
sz = approx_size(data)
3131
tok = MemToken(myid(), next_token_id(), sz)
3232

3333
if !isempty(freeable_lru)

Diff for: src/thunk.jl

+6-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ function affinity(t::Thunk)
4545
end
4646
end
4747
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
4954
end
5055

5156
function delayed(f; kwargs...)

0 commit comments

Comments
 (0)