Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -10,8 +10,13 @@ int sum(int s)
|
|||
return s;
|
||||
}
|
||||
|
||||
#define CLOCKTYPE CLOCK_MONOTONIC
|
||||
#ifdef CLOCK_PROCESS_CPUTIME_ID
|
||||
/* cpu time in the current process */
|
||||
#define CLOCKTYPE CLOCK_PROCESS_CPUTIME_ID
|
||||
#else
|
||||
/* this one should be appropriate to avoid errors on multiprocessors systems */
|
||||
#define CLOCKTYPE CLOCK_MONOTONIC
|
||||
#endif
|
||||
|
||||
double time_it(int (*action)(int), int arg)
|
||||
{
|
||||
|
|
|
|||
2
Task/Time-a-function/Elixir/time-a-function-1.elixir
Normal file
2
Task/Time-a-function/Elixir/time-a-function-1.elixir
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
iex(10)> :timer.tc(fn -> Enum.each(1..100000, fn x -> x*x end) end)
|
||||
{236000, :ok}
|
||||
2
Task/Time-a-function/Elixir/time-a-function-2.elixir
Normal file
2
Task/Time-a-function/Elixir/time-a-function-2.elixir
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
iex(11)> :timer.tc(fn x -> Enum.each(1..x, fn y -> y*y end) end, [1000000])
|
||||
{2300000, :ok}
|
||||
5
Task/Time-a-function/Elixir/time-a-function-3.elixir
Normal file
5
Task/Time-a-function/Elixir/time-a-function-3.elixir
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
iex(12)> :timer.tc(Enum, :to_list, [1..1000000])
|
||||
{224000,
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
|
||||
23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
|
||||
42, 43, 44, 45, 46, 47, 48, 49, ...]}
|
||||
12
Task/Time-a-function/PowerShell/time-a-function.psh
Normal file
12
Task/Time-a-function/PowerShell/time-a-function.psh
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
function fun($n){
|
||||
$res = 0
|
||||
if($n -gt 0) {
|
||||
1..$n | foreach{
|
||||
$a, $b = $_, ($n+$_)
|
||||
$res += $a + $b
|
||||
}
|
||||
|
||||
}
|
||||
$res
|
||||
}
|
||||
"$((Measure-Command {fun 10000}).TotalSeconds) Seconds"
|
||||
Loading…
Add table
Add a link
Reference in a new issue