In [1]:
using Matching

In [2]:
module EikiTakigawa
include("EikiTakigawa/DA_1to1.jl")
deferred_acceptance = Match
end

module IoriS
include("IoriS/deferred_acceptance.jl")
deferred_acceptance = deferred_acceptance
end

module keiikegami
include("keiikegami/ikegamida.jl")
deferred_acceptance = ikegamida
end

module M_okb
include("M_okb/one-to-one.jl")
deferred_acceptance = DA_algo
end

module myuuuuun
include("myuuuuun/matching.jl")
deferred_acceptance = Matching.gale_shapley_T
end

module NlGG
include("NlGG/deferred_acceptance.jl")
deferred_acceptance = deferred_acceptance
end

module nswa17
include("nswa17/da.jl")
deferred_acceptance = DA.call_match
end

module oyamad
deferred_acceptance = Main.Matching.deferred_acceptance
end

module R_Tsushima
include("R_Tsushima/deffered_acceptance.jl")
deferred_acceptance = def_acc
end

module oyataku1
include("oyataku1/deferred_acceptance.jl")
deferred_acceptance = deferred_acceptance
end

module SUZUKITAISHI
include("SUZUKITAISHI/my_Gale_Shap.jl")
deferred_acceptance = my_Gale_Shap
end

module taneaki
include("taneaki/deferred_acceptance.jl")
deferred_acceptance = deferred_acceptance
end

module tsuyoshi
include("tsuyoshi/deferred_acceptance.jl")
deferred_acceptance = deferred_acceptance
end;

In [3]:
modules = [
    EikiTakigawa,
    IoriS,
    keiikegami,
    M_okb,
    myuuuuun,
    NlGG,
    nswa17,
    oyamad,
    R_Tsushima,
    SUZUKITAISHI,
    taneaki,
    tsuyoshi,
];

In [4]:
m, n = 10, 5
srand(1234)
m_prefs, f_prefs = random_prefs(m, n)

prop_matches_oy, resp_matches_oy = oyamad.deferred_acceptance(m_prefs, f_prefs)

for m in modules
    println(m)
    @time prop_matches, resp_matches = getfield(m, :deferred_acceptance)(m_prefs, f_prefs)
    @time getfield(m, :deferred_acceptance)(m_prefs, f_prefs)
    @time getfield(m, :deferred_acceptance)(m_prefs, f_prefs)
    if prop_matches == prop_matches_oy && resp_matches == resp_matches_oy
        println("  OK")
    else
        println("  returned: $prop_matches; expected: $prop_matches_oy")
        println("  returned: $resp_matches; expected: $resp_matches_oy")
    end
end


EikiTakigawa
  0.106061 seconds (72.63 k allocations: 3.532 MB, 5.97% gc time)
  0.000099 seconds (207 allocations: 29.078 KB)
  0.000051 seconds (207 allocations: 29.078 KB)
  OK
IoriS
  0.023346 seconds (10.16 k allocations: 487.900 KB)
  0.000020 seconds (132 allocations: 11.422 KB)
  0.000013 seconds (132 allocations: 11.422 KB)
  OK
keiikegami
  0.107111 seconds (75.78 k allocations: 3.639 MB)
  0.000448 seconds (1.83 k allocations: 230.500 KB)
  0.000440 seconds (1.83 k allocations: 230.500 KB)
  OK
M_okb
  0.341093 seconds (297.64 k allocations: 13.702 MB)
  0.000441 seconds (877 allocations: 431.281 KB)
  0.000497 seconds (877 allocations: 431.281 KB)
  OK
myuuuuun
  0.604522 seconds (579.29 k allocations: 26.004 MB, 2.58% gc time)
  0.000213 seconds (398 allocations: 28.969 KB)
  0.000193 seconds (398 allocations: 28.969 KB)
  OK
NlGG
  0.086360 seconds (55.49 k allocations: 2.893 MB)
  0.000363 seconds (663 allocations: 298.578 KB)
  0.000354 seconds (663 allocations: 298.578 KB)
  OK
nswa17
  0.103620 seconds (94.97 k allocations: 4.399 MB)
  0.000010 seconds (25 allocations: 2.281 KB)
  0.000006 seconds (25 allocations: 2.281 KB)
  OK
oyamad
  0.000015 seconds (15 allocations: 5.500 KB)
  0.000008 seconds (13 allocations: 5.438 KB)
  0.000008 seconds (13 allocations: 5.438 KB)
  OK
R_Tsushima
  0.058358 seconds (21.42 k allocations: 987.640 KB)
  0.000009 seconds (124 allocations: 10.734 KB)
  0.000007 seconds (124 allocations: 10.734 KB)
  OK
SUZUKITAISHI
  0.023525 seconds (10.08 k allocations: 483.159 KB)
  0.000014 seconds (169 allocations: 13.984 KB)
  0.000012 seconds (169 allocations: 13.984 KB)
  OK
taneaki
  0.068400 seconds (51.80 k allocations: 2.955 MB)
  0.000810 seconds (1.29 k allocations: 578.781 KB)
  0.000928 seconds (1.29 k allocations: 578.781 KB)
  OK
tsuyoshi
  0.082499 seconds (59.63 k allocations: 3.081 MB)
  0.000701 seconds (1.06 k allocations: 444.625 KB)
  0.000767 seconds (1.06 k allocations: 444.625 KB)
  OK

In [5]:
function performance(m::Int, n::Int, rng::AbstractRNG)
    m_prefs, f_prefs = random_prefs(rng, m, n)
    
    times = Array(Float64, length(modules))
    allocs = Array(Int, length(modules))
    
    for (i, m) in enumerate(modules)
        getfield(m, :deferred_acceptance)(m_prefs, f_prefs)
        getfield(m, :deferred_acceptance)(m_prefs, f_prefs)
        _, time, alloc, _ = @timed getfield(m, :deferred_acceptance)(m_prefs, f_prefs)
        times[i] = time
        allocs[i] = alloc
    end
    
    indices = sortperm(times)
    for i in indices
        println(modules[i])
        @printf("  %0.9f seconds\n", times[i])
    end
end

performance(m::Int, n::Int, seed::Int) = performance(m, n, MersenneTwister(seed))
performance(m::Int, n::Int) = performance(m, n, Base.GLOBAL_RNG)


Out[5]:
performance (generic function with 3 methods)

In [6]:
seed = 1234


Out[6]:
1234

In [7]:
performance(100, 100, seed)


oyamad
  0.000221331 seconds
nswa17
  0.000488479 seconds
IoriS
  0.000602992 seconds
R_Tsushima
  0.000658195 seconds
SUZUKITAISHI
  0.001211153 seconds
EikiTakigawa
  0.008241735 seconds
M_okb
  0.014914887 seconds
NlGG
  0.017766797 seconds
tsuyoshi
  0.020691306 seconds
taneaki
  0.024612965 seconds
myuuuuun
  0.027506637 seconds
keiikegami
  0.057986320 seconds

In [8]:
performance(200, 200, seed)


oyamad
  0.000564630 seconds
nswa17
  0.000648619 seconds
R_Tsushima
  0.002858226 seconds
IoriS
  0.004261418 seconds
SUZUKITAISHI
  0.005168687 seconds
EikiTakigawa
  0.016816890 seconds
NlGG
  0.030689119 seconds
M_okb
  0.043094320 seconds
taneaki
  0.055162791 seconds
tsuyoshi
  0.056099384 seconds
myuuuuun
  0.120794086 seconds
keiikegami
  0.368281538 seconds

In [9]:
performance(500, 500, seed)


nswa17
  0.003090224 seconds
oyamad
  0.005309202 seconds
IoriS
  0.044104833 seconds
R_Tsushima
  0.046730926 seconds
EikiTakigawa
  0.072311565 seconds
SUZUKITAISHI
  0.106667313 seconds
NlGG
  0.170870000 seconds
M_okb
  0.178814788 seconds
taneaki
  0.230815609 seconds
tsuyoshi
  0.277304893 seconds
myuuuuun
  0.828617824 seconds
keiikegami
  1.841906706 seconds

In [10]:
performance(1000, 1000, seed)


oyamad
  0.020284146 seconds
nswa17
  0.023437959 seconds
IoriS
  0.272567810 seconds
R_Tsushima
  0.288714143 seconds
EikiTakigawa
  0.487449982 seconds
SUZUKITAISHI
  0.562590783 seconds
M_okb
  0.821492521 seconds
NlGG
  0.940333546 seconds
taneaki
  1.027299721 seconds
tsuyoshi
  1.436587934 seconds
myuuuuun
  3.959924946 seconds
keiikegami
  18.887157292 seconds

In [ ]: