mirror of
https://github.com/fverdugo/XM_40017.git
synced 2025-11-08 19:54:25 +01:00
Merge pull request #46 from fverdugo/francesc
Fix questions julia_async notebook
This commit is contained in:
commit
0039ea85e2
@ -53,7 +53,7 @@
|
||||
"end\n",
|
||||
"function why_q2()\n",
|
||||
" msg = \"\"\"\n",
|
||||
" The time in doing the loop will be almost zero since the loop just schedules 10 tasks, which should be very fast.\n",
|
||||
" The time in doing the loop will be O(1) since the loop just schedules 10 tasks, which should be a (small) constant time independent of n.\n",
|
||||
" \"\"\"\n",
|
||||
" println(msg)\n",
|
||||
"end\n",
|
||||
@ -758,7 +758,8 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"t = @elapsed @show compute_π(140_000_000)"
|
||||
"n = 140_000_000\n",
|
||||
"t = @elapsed @show compute_π(n)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -773,7 +774,7 @@
|
||||
" a) 10*t\n",
|
||||
" b) t\n",
|
||||
" c) 0.1*t\n",
|
||||
" d) near 0*t \n"
|
||||
" d) O(1), i.e. time independent from n \n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -783,8 +784,9 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"n = 140_000_000\n",
|
||||
"@time for i in 1:10\n",
|
||||
" @show compute_π(140_000_000)\n",
|
||||
" @show compute_π(n)\n",
|
||||
"end"
|
||||
]
|
||||
},
|
||||
@ -810,7 +812,7 @@
|
||||
" a) 10*t\n",
|
||||
" b) t\n",
|
||||
" c) 0.1*t\n",
|
||||
" d) near 0*t \n",
|
||||
" d) O(1) \n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
@ -821,8 +823,9 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"n = 140_000_000\n",
|
||||
"@time for i in 1:10\n",
|
||||
" @async @show compute_π(140_000_000)\n",
|
||||
" @async @show compute_π(n)\n",
|
||||
"end"
|
||||
]
|
||||
},
|
||||
@ -848,7 +851,7 @@
|
||||
" a) 10*t\n",
|
||||
" b) t\n",
|
||||
" c) 0.1*t\n",
|
||||
" d) near 0*t \n"
|
||||
" d) O(1) \n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -858,8 +861,9 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"n = 140_000_000\n",
|
||||
"@time @sync for i in 1:10\n",
|
||||
" @async @show compute_π(140_000_000)\n",
|
||||
" @async @show compute_π(n)\n",
|
||||
"end"
|
||||
]
|
||||
},
|
||||
@ -884,7 +888,7 @@
|
||||
"\n",
|
||||
" a) infinity\n",
|
||||
" b) 1 second\n",
|
||||
" c) near 0 seconds\n",
|
||||
" c) less than 1 seconds\n",
|
||||
" d) 3 seconds"
|
||||
]
|
||||
},
|
||||
@ -934,7 +938,7 @@
|
||||
"\n",
|
||||
" a) infinity\n",
|
||||
" b) 1 second\n",
|
||||
" c) near 0 seconds\n",
|
||||
" c) less than 1 seconds\n",
|
||||
" d) 3 seconds"
|
||||
]
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user