Skip to content

Instantly share code, notes, and snippets.

@oyamad
Last active February 14, 2018 12:54
Show Gist options
  • Save oyamad/39abef91809a2293def004bc5db3fb07 to your computer and use it in GitHub Desktop.
Save oyamad/39abef91809a2293def004bc5db3fb07 to your computer and use it in GitHub Desktop.
Timing for bimatrix_generators
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"using Games\n",
"using Games.Generators\n",
"using BenchmarkTools"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2016×2016 NormalFormGame{2,Float64}"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"blotto_game(3, 62, 0.5)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2024×2024 NormalFormGame{2,Float64}"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"blotto_game(4, 21, 0.5)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2000×2000 NormalFormGame{2,Float64}"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ranking_game(2000)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1999×1999 NormalFormGame{2,Float64}"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sgc_game(500)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"200×19900 NormalFormGame{2,Float64}"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tournament_game(200, 2)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2000×2000 NormalFormGame{2,Float64}"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"unit_vector_game(2000)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2000×2000 NormalFormGame{2,Float64}"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"unit_vector_game(2000, random=false)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"seed = 1234\n",
"rng = MersenneTwister(seed);"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"BenchmarkTools.Trial: \n",
" memory estimate: 62.06 MiB\n",
" allocs estimate: 55\n",
" --------------\n",
" minimum time: 108.409 ms (0.77% GC)\n",
" median time: 131.664 ms (11.46% GC)\n",
" mean time: 160.491 ms (32.10% GC)\n",
" maximum time: 209.822 ms (48.05% GC)\n",
" --------------\n",
" samples: 32\n",
" evals/sample: 1"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@benchmark blotto_game(rng, 3, 62, 0.5)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"BenchmarkTools.Trial: \n",
" memory estimate: 62.57 MiB\n",
" allocs estimate: 55\n",
" --------------\n",
" minimum time: 125.656 ms (3.30% GC)\n",
" median time: 143.141 ms (10.68% GC)\n",
" mean time: 178.635 ms (29.23% GC)\n",
" maximum time: 231.566 ms (46.92% GC)\n",
" --------------\n",
" samples: 28\n",
" evals/sample: 1"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@benchmark blotto_game(rng, 4, 21, 0.5)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"BenchmarkTools.Trial: \n",
" memory estimate: 195.72 MiB\n",
" allocs estimate: 68\n",
" --------------\n",
" minimum time: 202.256 ms (47.85% GC)\n",
" median time: 243.991 ms (53.56% GC)\n",
" mean time: 265.457 ms (59.26% GC)\n",
" maximum time: 327.335 ms (63.05% GC)\n",
" --------------\n",
" samples: 19\n",
" evals/sample: 1"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@benchmark ranking_game(rng, 2000)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"BenchmarkTools.Trial: \n",
" memory estimate: 60.98 MiB\n",
" allocs estimate: 23\n",
" --------------\n",
" minimum time: 15.690 ms (3.53% GC)\n",
" median time: 30.793 ms (50.07% GC)\n",
" mean time: 67.779 ms (79.44% GC)\n",
" maximum time: 122.490 ms (84.53% GC)\n",
" --------------\n",
" samples: 74\n",
" evals/sample: 1"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@benchmark sgc_game(500)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"BenchmarkTools.Trial: \n",
" memory estimate: 185.66 MiB\n",
" allocs estimate: 3033423\n",
" --------------\n",
" minimum time: 1.634 s (6.86% GC)\n",
" median time: 1.641 s (7.08% GC)\n",
" mean time: 1.641 s (7.10% GC)\n",
" maximum time: 1.648 s (7.07% GC)\n",
" --------------\n",
" samples: 4\n",
" evals/sample: 1"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@benchmark tournament_game(seed, 200, 2)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"BenchmarkTools.Trial: \n",
" memory estimate: 91.55 MiB\n",
" allocs estimate: 27\n",
" --------------\n",
" minimum time: 30.491 ms (4.81% GC)\n",
" median time: 134.342 ms (79.80% GC)\n",
" mean time: 132.555 ms (79.07% GC)\n",
" maximum time: 145.203 ms (79.62% GC)\n",
" --------------\n",
" samples: 38\n",
" evals/sample: 1"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@benchmark unit_vector_game(rng, 2000)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"BenchmarkTools.Trial: \n",
" memory estimate: 230.43 MiB\n",
" allocs estimate: 5053412\n",
" --------------\n",
" minimum time: 330.653 ms (31.72% GC)\n",
" median time: 356.787 ms (33.96% GC)\n",
" mean time: 352.968 ms (34.06% GC)\n",
" maximum time: 368.262 ms (35.83% GC)\n",
" --------------\n",
" samples: 15\n",
" evals/sample: 1"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@benchmark unit_vector_game(rng, 2000, random=false)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 0.6.2",
"language": "julia",
"name": "julia-0.6"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "0.6.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment