iex(1)> defmodule RepeatN do def repeat_n(function, count) do ...(1)> end repeat_n(function, count - 1) {:module, RepeatN,...}

Size: px
Start display at page:

Download "iex(1)> defmodule RepeatN do def repeat_n(function, count) do ...(1)> end repeat_n(function, count - 1) {:module, RepeatN,...}"

Transcription

1 The other day

2 iex(1)>

3 iex(1)> defmodule RepeatN do...(1)> def repeat_n(_function, 0) do...(1)> # noop...(1)>...(1)> def repeat_n(function, 1) do...(1)> function.()...(1)>...(1)> def repeat_n(function, count) do...(1)> function.()...(1)> repeat_n(function, count - 1)...(1)>...(1)> {:module, RepeatN,...}

4 iex(1)> defmodule RepeatN do...(1)> def repeat_n(_function, 0) do...(1)> # noop...(1)>...(1)> def repeat_n(function, 1) do...(1)> function.()...(1)>...(1)> def repeat_n(function, count) do...(1)> function.()...(1)> repeat_n(function, count - 1)...(1)>...(1)> {:module, RepeatN,...} iex(2)> :timer.tc fn -> RepeatN.repeat_n(fn -> 0, 100) {210, 0}

5 iex(1)> defmodule RepeatN do...(1)> def repeat_n(_function, 0) do...(1)> # noop...(1)>...(1)> def repeat_n(function, 1) do...(1)> function.()...(1)>...(1)> def repeat_n(function, count) do...(1)> function.()...(1)> repeat_n(function, count - 1)...(1)>...(1)> {:module, RepeatN,...} iex(2)> :timer.tc fn -> RepeatN.repeat_n(fn -> 0, 100) {210, 0} iex(3)> list = Enum.to_list(1..100) [...] iex(4)> :timer.tc fn -> Enum.each(list, fn(_) -> 0 ) {165, :ok}

6 iex(1)> defmodule RepeatN do...(1)> def repeat_n(_function, 0) do...(1)> # noop...(1)>...(1)> def repeat_n(function, 1) do...(1)> function.()...(1)>...(1)> def repeat_n(function, count) do...(1)> function.()...(1)> repeat_n(function, count - 1)...(1)>...(1)> {:module, RepeatN,...} iex(2)> :timer.tc fn -> RepeatN.repeat_n(fn -> 0 {210, 0} iex(3)> list = Enum.to_list(1..100) [...] iex(4)> :timer.tc fn -> Enum.each(list, fn(_) -> {165, :ok} iex(5)> :timer.tc fn -> Enum.each(list, fn(_) -> {170, :ok} iex(6)> :timer.tc fn -> Enum.each(list, fn(_) -> {184, :ok}, 100) 0 ) 0 ) 0 )

7 Success!

8 The End?

9

10 Way too few samples Realistic data/multiple inputs? No warmup Non production environment Does creating the list matter? Is repeating really the bottle neck? Repeatability? Setup information Running on battery Lots of applications running Numerous Failures!

11 n range list fun = = = = 10_ n Enum.to_list range fn -> 0 Benchee.run %{ "Enum.each" => fn -> Enum.each(list, fn(_) -> fun.() ), "List comprehension" => fn -> for _ <- list, do: fun.(), "Recursion" => fn -> RepeatN.repeat_n(fun, n) }

12 Name Recursion Enum.each List comprehension ips 6.95 K 4.21 K 3.07 K average μs μs μs Comparison: Recursion Enum.each List comprehension 6.95 K 4.21 K x slower 3.07 K x slower deviation ±2.76% ±6.47% ±10.02% median 142 μs 230 μs 333 μs 99th % 156 μs 278 μs 373 μs

13 Iterations per Second Name Recursion Enum.each List comprehension ips 6.95 K 4.21 K 3.07 K average μs μs μs Comparison: Recursion Enum.each List comprehension 6.95 K 4.21 K x slower 3.07 K x slower deviation ±2.76% ±6.47% ±10.02% median 142 μs 230 μs 333 μs 99th % 156 μs 278 μs 373 μs

14 Stop guessing and Start Measuring Benchmarking in Practice Tobias pragtob.info github.com/pragtob/benchee

15

16

17

18 Concept vs Tool Usage

19 What s Benchmarking?

20

21 Profiling vs Benchmarking

22 Flame Graph El.. Elixir.Enum:-map/2-lc$^0/1-0-/2 El.. Elixir.Enum:-map/2-lc$^0/1-0-/2 El.. Elixir.Enum:-map/2-lc$^0/1-0-/2 El.. Elixir.Enum:-map/2-lc$^0/1-0-/2 El.. Elixir.Enum:-map/2-lc$^0/1-0-/2 El.. El.. Elixir.Life.Board:map/2 El.. Elixir.Life.Board:map/2 El.. Elixir.Life.Board:map/2 El.. Elixir.Life.Board:map/2 El.. Elixir.Life.Board:map/2 El.. Eli.. Elixir.Life:run_loop/3 eflame:apply1/3 (0.47.0)

23 What to benchmark?

24 What to measure? Runtime? Memory? Throughput? Custom?

25 The famous post

26 What to measure? Runtime! Memory? Throughput? Custom?

27 How long will this take?

28 Enum.sort/1 performance

29 Enum.sort/1 performance

30 Did we make it faster?

31 What s fastest?

32 What's the fastest way to sort a list of numbers largest to smallest?

33 list = 1..10_000 > Enum.to_list > Enum.shuffle Benchee.run %{ "sort(fun)" => fn -> Enum.sort(list, &(&1 > &2)), "sort > reverse" => fn -> list > Enum.sort > Enum.reverse, "sort_by(-value)" => fn -> Enum.sort_by(list, fn(val) -> -val ) }

34 list = 1..10_000 > Enum.to_list > Enum.shuffle Benchee.run %{ "sort(fun)" => fn -> Enum.sort(list, &(&1 > &2)), "sort > reverse" => fn -> list > Enum.sort > Enum.reverse, "sort_by(-value)" => fn -> Enum.sort_by(list, fn(val) -> -val ) }

35 list = 1..10_000 > Enum.to_list > Enum.shuffle Benchee.run %{ "sort(fun)" => fn -> Enum.sort(list, &(&1 > &2)), "sort > reverse" => fn -> list > Enum.sort > Enum.reverse, "sort_by(-value)" => fn -> Enum.sort_by(list, fn(val) -> -val ) }

36 list = 1..10_000 > Enum.to_list > Enum.shuffle Benchee.run %{ "sort(fun)" => fn -> Enum.sort(list, &(&1 > &2)), "sort > reverse" => fn -> list > Enum.sort > Enum.reverse, "sort_by(-value)" => fn -> Enum.sort_by(list, fn(val) -> -val ) }

37 Name sort > reverse sort(fun) sort_by(-value) ips average 1.74 ms 4.15 ms 6.67 ms Comparison: sort > reverse sort(fun) sort_by(-value) x slower x slower deviation ±7.11% ±3.04% ±6.06% median 1.70 ms 4.15 ms 6.50 ms 99th % 2.25 ms 4.60 ms 7.83 ms

38 Isn t that the root of all evil?

39 More likely, not reading the sources is the source of all evil. Me, just now

40 Yup it s there We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Donald Knuth, 1974 (Computing Surveys, Vol 6, No 4, December 1974)

41 The very next sentence Yet we should not pass up our opportunities in that critical 3%. Donald Knuth, 1974 (Computing Surveys, Vol 6, No 4, December 1974)

42 Prior Paragraph (...) a 12 % improvement, easily obtained, is never considered marginal Donald Knuth, 1974 (Computing Surveys, Vol 6, No 4, December 1974)

43 Different types of benchmarks

44 Testing Pyramid Feature Integration Unit

45 Benchmarking Pyramid Application Macro Micro

46 Micro Macro Application

47 Micro Macro Components involved Application

48 Micro Macro Components involved Setup Complexity Application

49 Micro Macro Components involved Setup Complexity Execution Time Application

50 Micro Macro Components involved Setup Complexity Execution Time Confidence of Real Impact Application

51 Micro Macro Components involved Setup Complexity Execution Time Confidence of Real Impact Chance of Interference Application

52 Micro Golden Middle Macro Components involved Setup Complexity Execution Time Confidence of Real Impact Chance of Interference Application

53 Good Benchmarking

54 What are you benchmarking for?

55 System Specification Elixir Erlang 20.2 i5-7200u 2 x 2.5GHz (Up to 3.10GHz) 8GB RAM Linux Mint bit (Ubuntu base)

56 System Specification elixir_playground $ mix run bench/something.exs Operating System: Linux CPU Information: Intel(R) Core(TM) i5-7200u 2.50GHz Number of Available Cores: 4 Available memory: 7.67 GB Elixir Erlang 20.2 Benchmark suite executing with the following configuration: warmup: 2 s time: 5 s parallel: 1 inputs: none specified Estimated total run time: 21 s

57

58

59 1.4!

60 1.3

61 Correct & Meaningful Setup

62 Interference free Environment

63 [info] GET / [debug] Processing by Rumbl.PageController.index/2 Parameters: %{} Pipelines: [:browser] [info] Sent 200 in 46ms [info] GET /sessions/new [debug] Processing by Rumbl.SessionController.new/2 Parameters: %{} Pipelines: [:browser] [info] Sent 200 in 5ms [info] GET /users/new [debug] Processing by Rumbl.UserController.new/2 Parameters: %{} Pipelines: [:browser] [info] Sent 200 in 7ms [info] POST /users [debug] Processing by Rumbl.UserController.create/2 Parameters: %{"_csrf_token" => "NUEUdRMNAiBfIHEeNwZkfA05PgAOJgAAf0ACXJqCjl7YojW+trdjdg==", "_utf8" => " ", "user" => %{"name" => "asdasd", "password" => "[FILTERED]", "username" => "Homer"}} Pipelines: [:browser] [debug] QUERY OK db=0.1ms begin [] [debug] QUERY OK db=0.9ms INSERT INTO "users" ("name","password_hash","username","inserted_at","updated_at") VALUES ($1,$2,$3,$4,$5) RETURNING "id" ["asdasd", "$2b$12$.qY/kpo0Dec7vMK1ClJoC.Lw77c3oGllX7uieZILMlFh2hFpJ3F.C", "Homer", {{2016, 12, 2}, {14, 10, 28, 0}}, {{2016, 12, 2}, {14, 10, 28, 0}}] Logging & Fris

64 Garbage Collection

65

66 Warmup

67 Probably not what you want $ time my_program

68 What s important for you?

69 What s important for you? Startup

70 What s important for you? Startup Warmup

71 What s important for you? Startup Warmup Runtime

72 28s 2s

73 Inputs matter!

74 Story Time

75 Boom

76 Boom Elixir.DBConnection.ConnectionError

77

78 Benchee.run %{ "DB View" => fn -> LatestCourierLocation > CourierLocation.with_courier_ids(courier_id) > Repo.one(timeout: :infinity), "with_courier_ids" => fn -> CourierLocation.with_courier_ids(courier_id) > Ecto.Query.order_by(desc: :time) > Ecto.Query.limit(1) > Repo.one(timeout: :infinity), "full custom" => fn -> CourierLocation > Ecto.Query.where(courier_id: ^courier_id) > Ecto.Query.order_by(desc: :time) > Ecto.Query.limit(1) > Repo.one(timeout: :infinity) }

79 Benchee.run %{ "DB View" => fn -> Database LatestCourierLocation > CourierLocation.with_courier_ids(courier_id) > Repo.one(timeout: :infinity), "with_courier_ids" => fn -> CourierLocation.with_courier_ids(courier_id) > Ecto.Query.order_by(desc: :time) > Ecto.Query.limit(1) > Repo.one(timeout: :infinity), "full custom" => fn -> CourierLocation > Ecto.Query.where(courier_id: ^courier_id) > Ecto.Query.order_by(desc: :time) > Ecto.Query.limit(1) > Repo.one(timeout: :infinity) } View

80 Benchee.run %{ "DB View" => fn -> Only difference LatestCourierLocation > CourierLocation.with_courier_ids(courier_id) > Repo.one(timeout: :infinity), "with_courier_ids" => fn -> CourierLocation.with_courier_ids(courier_id) > Ecto.Query.order_by(desc: :time) > Ecto.Query.limit(1) > Repo.one(timeout: :infinity), "full custom" => fn -> CourierLocation > Ecto.Query.where(courier_id: ^courier_id) > Ecto.Query.order_by(desc: :time) > Ecto.Query.limit(1) > Repo.one(timeout: :infinity) }

81 Benchee.run %{ "DB View" => fn -> LatestCourierLocation > CourierLocation.with_courier_ids(courier_id) > Repo.one(timeout: :infinity), "with_courier_ids" => fn -> CourierLocation.with_courier_ids(courier_id) > Ecto.Query.order_by(desc: :time) > Ecto.Query.limit(1) > Repo.one(timeout: :infinity), "full custom" => fn -> CourierLocation > Ecto.Query.where(courier_id: ^courier_id) > Ecto.Query.order_by(desc: :time) > Ecto.Query.limit(1) > Repo.one(timeout: :infinity) } Same

82 Another job well done? Name with_courier_ids full custom DB View ips average 1.02 ms 1.17 ms ms deviation ±43.22% ±53.86% ±4.89% Comparison: with_courier_ids full custom DB View x slower x slower median 0.91 ms 0.96 ms ms 99th % 3.19 ms 4.25 ms ms

83 Another job well done?

84 Boom

85 Boom Elixir.DBConnection.ConnectionError

86 Boom Elixir.DBConnection.ConnectionError Elixir.DBConnection.ConnectionError

87 Boom Elixir.DBConnection.ConnectionError Elixir.DBConnection.ConnectionError Elixir.DBConnection.ConnectionError Elixir.DBConnection.ConnectionError Elixir.DBConnection.ConnectionError Elixir.DBConnection.ConnectionError Elixir.DBConnection.ConnectionError Elixir.DBConnection.ConnectionError

88 Whaaaat?

89 inputs = %{ "Big 2.3 Million locations" "No locations" "~200k locations" "~20k locations" } => => => => Inputs to the rescue! 3799, 8901, 4238, 4201 Benchee.run %{... "full custom" => fn(courier_id) -> CourierLocation > Ecto.Query.where(courier_id: ^courier_id) > Ecto.Query.order_by(desc: :time) > Ecto.Query.limit(1) > Repo.one(timeout: :infinity) }, inputs: inputs, time: 25, warmup: 5

90 inputs = %{ "Big 2.3 Million locations" "No locations" "~200k locations" "~20k locations" } => => => => Inputs to the rescue! 3799, 8901, 4238, 4201 Benchee.run %{... "full custom" => fn(courier_id) -> CourierLocation > Ecto.Query.where(courier_id: ^courier_id) > Ecto.Query.order_by(desc: :time) > Ecto.Query.limit(1) > Repo.one(timeout: :infinity) }, inputs: inputs, time: 25, warmup: 5

91 inputs = %{ "Big 2.3 Million locations" "No locations" "~200k locations" "~20k locations" } => => => => Inputs to the rescue! 3799, 8901, 4238, 4201 Benchee.run %{... "full custom" => fn(courier_id) -> CourierLocation > Ecto.Query.where(courier_id: ^courier_id) > Ecto.Query.order_by(desc: :time) > Ecto.Query.limit(1) > Repo.one(timeout: :infinity) }, inputs: inputs, time: 25, warmup: 5

92 inputs = %{ "Big 2.3 Million locations" "No locations" "~200k locations" "~20k locations" } => => => => Inputs to the rescue! 3799, 8901, 4238, 4201 Benchee.run %{... "full custom" => fn(courier_id) -> CourierLocation > Ecto.Query.where(courier_id: ^courier_id) > Ecto.Query.order_by(desc: :time) > Ecto.Query.limit(1) > Repo.one(timeout: :infinity) }, inputs: inputs, time: 25, warmup: 5

93 ##### With input Big 2.5 million locations ##### with_courier_ids full custom x slower DB View x slower ##### With input ~200k locations ##### DB View 3.57 with_courier_ids x slower full custom x slower ##### With input ~20k locations ##### DB View with_courier_ids x slower full custom x slower ##### With input No locations ##### Comparison: DB View with_courier_ids x slower full custom x slower

94 ##### With input Big 2.5 million locations ##### with_courier_ids full custom x slower DB View x slower ##### With input ~200k locations ##### DB View 3.57 with_courier_ids x slower full custom x slower ##### With input ~20k locations ##### DB View with_courier_ids x slower full custom x slower ##### With input No Comparison: DB View with_courier_ids full custom locations ##### x slower x slower woops

95 EXPLAIN ANALYZE SELECT c0."id", c0."courier_id", c0."location", c0."time", c0."accuracy", c0."inserted_at", c0."updated_at" FROM "courier_locations" AS c0 WHERE (c0."courier_id" = 3799) ORDER BY c0."time" DESC LIMIT 1; QUERY PLAN Limit (cost= rows=1 width=72) (actual time= rows=1 loops=1) -> Index Scan Backward using courier_locations_time_index on courier_locations c0 (cost= rows= width=72) actual time= rows=1 loops=1) Filter: (courier_id = 3799) Rows Removed by Filter: 1371 Planning time: ms Execution time: ms (6 rows)

96 EXPLAIN ANALYZE SELECT c0."id", c0."courier_id", c0."location", c0."time", c0."accuracy", c0."inserted_at", c0."updated_at" FROM "courier_locations" AS c0 WHERE (c0."courier_id" = 3799) ORDER BY c0."time" DESC LIMIT 1; QUERY PLAN Limit (cost= rows=1 width=72) (actual time= rows=1 loops=1) -> Index Scan Backward using courier_locations_time_index on courier_locations c0 (cost= rows= width=72) actual time= rows=1 loops=1) Filter: (courier_id = 3799) Rows Removed by Filter: 1371 Planning time: ms Execution time: ms (6 rows)

97 EXPLAIN ANALYZE SELECT c0."id", c0."courier_id", c0."location", c0."time", c0."accuracy", c0."inserted_at", c0."updated_at" FROM "courier_locations" AS c0 WHERE (c0."courier_id" = 3799) ORDER BY c0."time" DESC LIMIT 1; QUERY PLAN Limit (cost= rows=1 width=72) (actual time= rows=1 loops=1) -> Index Scan Backward using courier_locations_time_index on courier_locations c0 (cost= rows= width=72) actual time= rows=1 loops=1) Filter: (courier_id = 3799) Rows Removed by Filter: 1371 Planning time: ms Execution time: ms (6 rows)

98 EXPLAIN ANALYZE SELECT c0."id", c0."courier_id", c0."location", c0."time", c0."accuracy", c0."inserted_at", c0."updated_at" FROM "courier_locations" AS c0 WHERE (c0."courier_id" = 3799) ORDER BY c0."time" DESC LIMIT 1; QUERY PLAN Limit (cost= rows=1 width=72) (actual time= rows=1 loops=1) -> Index Scan Backward using courier_locations_time_index on courier_locations c0 (cost= rows= width=72) actual time= rows=1 loops=1) Filter: (courier_id = 3799) Rows Removed by Filter: 1371 Planning time: ms Execution time: ms (6 rows)

99 Combined Indexes

100 No locations

101 20k locations

102 200k locations

103 Lots of locations

104 Let s talk about Tail Call Optimization

105 body defmodule MyMap do def map_body([], _func), do: [] def map_body([head tail], func) do [func.(head) map_body(tail, func)]

106 body defmodule MyMap do def map_body([], _func), do: [] def map_body([head tail], func) do [func.(head) map_body(tail, func)]

107 body defmodule MyMap do def map_body([], _func), do: [] def map_body([head tail], func) do [func.(head) map_body(tail, func)]

108 body defmodule MyMap do def map_body([], _func), do: [] def map_body([head tail], func) do [func.(head) map_body(tail, func)]

109 body defmodule MyMap do def map_body([], _func), do: [] def map_body([head tail], func) do [func.(head) map_body(tail, func)]

110 defmodule MyMap do TCO def map_tco(list, function) do Enum.reverse do_map_tco([], list, function) defp do_map_tco(acc, [], _function) do acc defp do_map_tco(acc, [head tail], func) do do_map_tco([func.(head) acc], tail, func)

111 defmodule MyMap do TCO def map_tco(list, function) do Enum.reverse do_map_tco([], list, function) defp do_map_tco(acc, [], _function) do acc defp do_map_tco(acc, [head tail], func) do do_map_tco([func.(head) acc], tail, func)

112 defmodule MyMap do TCO def map_tco(list, function) do Enum.reverse do_map_tco([], list, function) defp do_map_tco(acc, [], _function) do acc defp do_map_tco(acc, [head tail], func) do do_map_tco([func.(head) acc], tail, func)

113 defmodule MyMap do TCO def map_tco(list, function) do Enum.reverse do_map_tco([], list, function) defp do_map_tco(acc, [], _function) do acc defp do_map_tco(acc, [head tail], func) do do_map_tco([func.(head) acc], tail, func)

114 defmodule MyMap do TCO def map_tco(list, function) do Enum.reverse do_map_tco([], list, function) defp do_map_tco(acc, [], _function) do acc defp do_map_tco(acc, [head tail], func) do do_map_tco([func.(head) acc], tail, func)

115 defmodule MyMap do TCO def map_tco(list, function) do Enum.reverse do_map_tco([], list, function) defp do_map_tco(acc, [], _function) do acc defp do_map_tco(acc, [head tail], func) do do_map_tco([func.(head) acc], tail, func)

116 defmodule MyMap do TCO def map_tco(list, function) do Enum.reverse do_map_tco([], list, function) defp do_map_tco(acc, [], _function) do acc defp do_map_tco(acc, [head tail], func) do do_map_tco([func.(head) acc], tail, func)

117 defmodule MyMap do TCO def map_tco(list, function) do Enum.reverse do_map_tco([], list, function) defp do_map_tco(acc, [], _function) do acc defp do_map_tco(acc, [head tail], func) do do_map_tco([func.(head) acc], tail, func)

118 defmodule MyMap do TCO def map_tco(list, function) do Enum.reverse do_map_tco([], list, function) defp do_map_tco(acc, [], _function) do acc defp do_map_tco(acc, [head tail], func) do do_map_tco([func.(head) acc], tail, func)

119 defmodule MyMap do arg_order def map_tco(list, function) do Enum.reverse do_map_tco(list, function, []) defp do_map_tco([], _function, acc) do acc defp do_map_tco([head tail], func, acc) do do_map_tco(tail, func, [func.(head) acc])

120 map_fun = fn(i) -> i + 1 inputs = %{ "Small (10 Thousand)" => "Middle (100 Thousand)" => "Big (1 Million)" => "Bigger (5 Million)" => } TCO Enum.to_list(1..10_000), Enum.to_list(1..100_000), Enum.to_list(1..1_000_000), Enum.to_list(1..5_000_000) Benchee.run %{ "tail-recursive" => fn(list) -> MyMap.map_tco(list, map_fun), "stdlib map" => fn(list) -> Enum.map(list, map_fun), "body-recursive" => fn(list) -> MyMap.map_body(list, map_fun), "tail-rec arg-order" => fn(list) -> MyMap.map_tco_arg_order(list, map_fun) }

121 map_fun = fn(i) -> i + 1 inputs = %{ "Small (10 Thousand)" => "Middle (100 Thousand)" => "Big (1 Million)" => "Bigger (5 Million)" => } TCO Enum.to_list(1..10_000), Enum.to_list(1..100_000), Enum.to_list(1..1_000_000), Enum.to_list(1..5_000_000) Benchee.run %{ "tail-recursive" => fn(list) -> MyMap.map_tco(list, map_fun), "stdlib map" => fn(list) -> Enum.map(list, map_fun), "body-recursive" => fn(list) -> MyMap.map_body(list, map_fun), "tail-rec arg-order" => fn(list) -> MyMap.map_tco_arg_order(list, map_fun) }

122 map_fun = fn(i) -> i + 1 inputs = %{ "Small (10 Thousand)" => "Middle (100 Thousand)" => "Big (1 Million)" => "Bigger (5 Million)" => } TCO Enum.to_list(1..10_000), Enum.to_list(1..100_000), Enum.to_list(1..1_000_000), Enum.to_list(1..5_000_000) Benchee.run %{ "tail-recursive" => fn(list) -> MyMap.map_tco(list, map_fun), "stdlib map" => fn(list) -> Enum.map(list, map_fun), "body-recursive" => fn(list) -> MyMap.map_body(list, map_fun), "tail-rec arg-order" => fn(list) -> MyMap.map_tco_arg_order(list, map_fun) }

123 ##### With input Small (10 Thousand) ##### stdlib map 5.05 K body-recursive 5.00 K x slower tail-rec arg-order 4.07 K x slower tail-recursive 3.76 K x slower ##### With input Middle (100 Thousand) ##### stdlib map body-recursive x slower tail-rec arg-order x slower tail-recursive x slower ##### With input Big (1 Million) ##### body-recursive stdlib map x slower tail-rec arg-order x slower tail-recursive x slower ##### With input Bigger (5 Million) ##### tail-rec arg-order 6.68 tail-recursive x slower stdlib map x slower body-recursive x slower TCO

124 ##### With input Small (10 Thousand) ##### stdlib map 5.05 K body-recursive 5.00 K x slower tail-rec arg-order 4.07 K x slower tail-recursive 3.76 K x slower ##### With input Middle (100 Thousand) ##### stdlib map body-recursive x slower tail-rec arg-order x slower tail-recursive x slower ##### With input Big (1 Million) ##### body-recursive stdlib map x slower tail-rec arg-order x slower tail-recursive x slower ##### With input Bigger (5 Million) ##### tail-rec arg-order 6.68 tail-recursive x slower stdlib map x slower body-recursive x slower TCO

125 ##### With input Small (10 Thousand) ##### stdlib map 5.05 K body-recursive 5.00 K x slower tail-rec arg-order 4.07 K x slower tail-recursive 3.76 K x slower ##### With input Middle (100 Thousand) ##### stdlib map body-recursive x slower tail-rec arg-order x slower tail-recursive x slower ##### With input Big (1 Million) ##### body-recursive stdlib map x slower tail-rec arg-order x slower tail-recursive x slower ##### With input Bigger (5 Million) ##### tail-rec arg-order 6.68 tail-recursive x slower stdlib map x slower body-recursive x slower Big Inputs

126 Order matters! ##### With input Small (10 Thousand) ##### stdlib map 5.05 K body-recursive 5.00 K x slower tail-rec arg-order 4.07 K x slower tail-recursive 3.76 K x slower ##### With input Middle (100 Thousand) ##### stdlib map body-recursive x slower tail-rec arg-order x slower tail-recursive x slower ##### With input Big (1 Million) ##### body-recursive stdlib map x slower tail-rec arg-order x slower tail-recursive x slower ##### With input Bigger (5 Million) ##### tail-rec arg-order 6.68 tail-recursive x slower stdlib map x slower body-recursive x slower

127 TCO

128 What about Memory?

129 WIP

130 ##### With input Small (10 Thousand) stdlib map KB body-recursive KB tail-rec arg-order KB tail-recursive KB - ##### 1.00x memory usage 1.86x memory usage 1.86x memory usage ##### With input Middle (100 Thousand) ##### stdlib map 1.53 MB body-recursive 1.53 MB x memory usage tail-rec arg-order 1.80 MB x memory usage tail-recursive 1.80 MB x memory usage ##### With input Big (1 Million) ##### stdlib map MB body-recursive MB x memory usage tail-rec arg-order MB x memory usage tail-recursive MB x memory usage ##### With input Bigger (5 Million) ##### tail-rec arg-order MB tail-recursive MB x memory usage stdlib map MB x memory usage body-recursive MB x memory usage Memory

131 ##### With input Small (10 Thousand) stdlib map KB body-recursive KB tail-rec arg-order KB tail-recursive KB - ##### 1.00x memory usage 1.86x memory usage 1.86x memory usage ##### With input Middle (100 Thousand) ##### stdlib map 1.53 MB body-recursive 1.53 MB x memory usage tail-rec arg-order 1.80 MB x memory usage tail-recursive 1.80 MB x memory usage ##### With input Big (1 Million) ##### stdlib map MB body-recursive MB x memory usage tail-rec arg-order MB x memory usage tail-recursive MB x memory usage ##### With input Bigger (5 Million) ##### tail-rec arg-order MB tail-recursive MB x memory usage stdlib map MB x memory usage body-recursive MB x memory usage Memory

132 What even is a benchmark?

133 A transformation of inputs config > Benchee.init > Benchee.system > Benchee.benchmark("job", fn -> magic ) > Benchee.measure > Benchee.statistics > Benchee.Formatters.Console.output > Benchee.Formatters.HTML.output

134 RUN YOUR OWN BENCHMARKS

135 Enjoy Benchmarking Tobias pragtob.info github.com/pragtob/benchee

136 Excursion into Statistics

137 Average average = total_time / iterations

138 Standard Deviation defp standard_deviation(samples, average, iterations) do total_variance = Enum.reduce samples, 0, fn(sample, total) -> total + :math.pow((sample - average), 2) variance = total_variance / iterations :math.sqrt variance

139 Spread of Values defp standard_deviation(samples, average, iterations) do total_variance = Enum.reduce samples, 0, fn(sample, total) -> total + :math.pow((sample - average), 2) variance = total_variance / iterations :math.sqrt variance

140 Raw Run Times

141 Histogram

142 Outliers

143 Standard Deviation

144 Median defp compute_median(run_times, iterations) do sorted = Enum.sort(run_times) middle = div(iterations, 2) if Integer.is_odd(iterations) do sorted > Enum.at(middle) > to_float else (Enum.at(sorted, middle) + Enum.at(sorted, middle - 1)) / 2

145 Average

146 Mediam

147 Boxplot

Reverse Sort. array = (1..1_000).to_a. array.sort do item, other other <=> item end

Reverse Sort. array = (1..1_000).to_a. array.sort do item, other other <=> item end The other day Reverse Sort array = (1..1_000).to_a array.sort do item, other other item end CRuby vs JRuby $ ruby -v ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux] $ time ruby scripts/sort.rb

More information

Ruby-like Syntax. defmodule MyMap do def map([], _func), do: [] def map([head tail], func) do [func.(head) map(tail, func)] end end

Ruby-like Syntax. defmodule MyMap do def map([], _func), do: [] def map([head tail], func) do [func.(head) map(tail, func)] end end vs Ruby-like Syntax defmodule MyMap do def map([], _func), do: [] def map([head tail], func) do [func.(head) map(tail, func)] MyMap.map [1, 2, 3, 4], fn(i) -> i * i Ruby to Elixir what's great and

More information

Elixir and Phoenix. fast, concurrent and explicit. Tobias pragtob.info

Elixir and Phoenix. fast, concurrent and explicit. Tobias pragtob.info Elixir and Phoenix fast, concurrent and explicit Tobias Pfeiffer @PragTob pragtob.info Elixir and Phoenix fast, concurrent and explicit Tobias Pfeiffer @PragTob pragtob.info defmodule MyMap do def map([],

More information

Elixir and Phoenix fast, concurrent and explicit Tobias pragtob.info

Elixir and Phoenix fast, concurrent and explicit Tobias pragtob.info Elixir and Phoenix fast, concurrent and explicit Tobias Pfeiffer @PragTob pragtob.info Elixir and Phoenix fast, concurrent and explicit Tobias Pfeiffer @PragTob pragtob.info Platform defmodule MyMap do

More information

Elixir and Phoenix fast, concurrent and explicit Tobias pragtob.info

Elixir and Phoenix fast, concurrent and explicit Tobias pragtob.info Elixir and Phoenix fast, concurrent and explicit Tobias Pfeiffer @PragTob pragtob.info Elixir and Phoenix fast, concurrent and explicit Tobias Pfeiffer @PragTob pragtob.info Platform defmodule MyMap do

More information

Organized by Jean-François Cloutier Held at Big Room Studios, Portland, ME. Holy Elixir, Batman! Meetup June 16, 2015

Organized by Jean-François Cloutier Held at Big Room Studios, Portland, ME. Holy Elixir, Batman! Meetup June 16, 2015 Organized by Jean-François Cloutier Held at Big Room Studios, Portland, ME Holy Elixir, Batman! Meetup June 16, 2015 A Sampling of Elixir's Superhero Powers Second Order Functions Pipes Pattern Matching

More information

Macros, and protocols, and metaprogramming - Oh My!

Macros, and protocols, and metaprogramming - Oh My! Macros, and protocols, and metaprogramming - Oh My! (aka "What is Elixir and why should you care?") jim mccoy, Facebook Infosec Tools mccoy@fb.com (jim.mccoy@gmail.com) Who? Currently build and maintain

More information

CS 310: Memory Hierarchy and B-Trees

CS 310: Memory Hierarchy and B-Trees CS 310: Memory Hierarchy and B-Trees Chris Kauffman Week 14-1 Matrix Sum Given an M by N matrix X, sum its elements M rows, N columns Sum R given X, M, N sum = 0 for i=0 to M-1{ for j=0 to N-1 { sum +=

More information

Recap: Functions as first-class values

Recap: Functions as first-class values Recap: Functions as first-class values Arguments, return values, bindings What are the benefits? Parameterized, similar functions (e.g. Testers) Creating, (Returning) Functions Iterator, Accumul, Reuse

More information

Merge Sort Roberto Hibbler Dept. of Computer Science Florida Institute of Technology Melbourne, FL

Merge Sort Roberto Hibbler Dept. of Computer Science Florida Institute of Technology Melbourne, FL Merge Sort Roberto Hibbler Dept. of Computer Science Florida Institute of Technology Melbourne, FL 32901 rhibbler@cs.fit.edu ABSTRACT Given an array of elements, we want to arrange those elements into

More information

Performance Benchmark and Capacity Planning. Version: 7.3

Performance Benchmark and Capacity Planning. Version: 7.3 Performance Benchmark and Capacity Planning Version: 7.3 Copyright 215 Intellicus Technologies This document and its content is copyrighted material of Intellicus Technologies. The content may not be copied

More information

functional ErlangVM Parallelism

functional ErlangVM Parallelism functional functional ErlangVM functional ErlangVM Parallelism Who wants to go and build a system in Elixir? You shouldn t Elixir, Your Monolith and You Tobias Pfeiffer @PragTob pragtob.info Your Monolith

More information

Versioned APIs with Phoenix. Elvio Vicosa

Versioned APIs with Phoenix. Elvio Vicosa Versioned APIs with Phoenix Elvio Vicosa About the author My name is Elvio Vicosa and I am a software developer based in Berlin, Germany. I've been working with software for over 10 years and throughout

More information

Software Analysis. Asymptotic Performance Analysis

Software Analysis. Asymptotic Performance Analysis Software Analysis Performance Analysis Presenter: Jonathan Aldrich Performance Analysis Software Analysis 1 Asymptotic Performance Analysis How do we compare algorithm performance? Abstract away low-level

More information

The main issue is that the mean and standard deviations are not accurate and should not be used in the analysis. Then what statistics should we use?

The main issue is that the mean and standard deviations are not accurate and should not be used in the analysis. Then what statistics should we use? Chapter 4 Analyzing Skewed Quantitative Data Introduction: In chapter 3, we focused on analyzing bell shaped (normal) data, but many data sets are not bell shaped. How do we analyze quantitative data when

More information

Chapter 5snow year.notebook March 15, 2018

Chapter 5snow year.notebook March 15, 2018 Chapter 5: Statistical Reasoning Section 5.1 Exploring Data Measures of central tendency (Mean, Median and Mode) attempt to describe a set of data by identifying the central position within a set of data

More information

CPS506 - Comparative Programming Languages Elixir

CPS506 - Comparative Programming Languages Elixir CPS506 - Comparative Programming Languages Elixir Dr. Dave Mason Department of Computer Science Ryerson University c 2017 Dave Mason History Joe Armstrong worked at Ericson Erlang originally for lab development

More information

A Small Web Server. Programming II - Elixir Version. Johan Montelius. Spring Term 2018

A Small Web Server. Programming II - Elixir Version. Johan Montelius. Spring Term 2018 A Small Web Server Programming II - Elixir Version Johan Montelius Spring Term 2018 Introduction Your task is to implement a small web server in Elixir. exercise is that you should be able to: The aim

More information

The Actor Model, Part Two. CSCI 5828: Foundations of Software Engineering Lecture 18 10/23/2014

The Actor Model, Part Two. CSCI 5828: Foundations of Software Engineering Lecture 18 10/23/2014 The Actor Model, Part Two CSCI 5828: Foundations of Software Engineering Lecture 18 10/23/2014 1 Goals Cover the material presented in Chapter 5, of our concurrency textbook In particular, the material

More information

Optimizing Testing Performance With Data Validation Option

Optimizing Testing Performance With Data Validation Option Optimizing Testing Performance With Data Validation Option 1993-2016 Informatica LLC. No part of this document may be reproduced or transmitted in any form, by any means (electronic, photocopying, recording

More information

Phoenix Is Not Your Application. Lance Halvorsen ElixirConf EU 2016

Phoenix Is Not Your Application. Lance Halvorsen ElixirConf EU 2016 Phoenix Is Not Your Application Lance Halvorsen ElixirConf EU 2016 Phoenix is one of your applications. Our Language Gives Us Away We Say I'm building a Phoenix app. Or a Rails app. Or an Ember app. Or

More information

Do Query Op5mizers Need to be SSD- aware?

Do Query Op5mizers Need to be SSD- aware? Do Query Op5mizers Need to be SSD- aware? Steven Pelley, Kristen LeFevre, Thomas F. Wenisch, University of Michigan CSE ADMS 2011 1 Enterprise flash: a new hope Disk Flash Model WD 10Krpm OCZ RevoDrive

More information

News. CSE 130: Programming Languages. Environments & Closures. Functions are first-class values. Recap: Functions as first-class values

News. CSE 130: Programming Languages. Environments & Closures. Functions are first-class values. Recap: Functions as first-class values CSE 130: Programming Languages Environments & Closures News PA 3 due THIS Friday (5/1) Midterm NEXT Friday (5/8) Ranjit Jhala UC San Diego Recap: Functions as first-class values Arguments, return values,

More information

Patrol Management Online Report System

Patrol Management Online Report System Patrol Management Online Report System System Administrator Guide Table of Contents I. About this guide...1 II. Introduction...1 1. System architecture...1 2. System requirements...3 III. Installing Patrol

More information

External Sorting. Chapter 13. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1

External Sorting. Chapter 13. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 External Sorting Chapter 13 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Why Sort? v A classic problem in computer science! v Data requested in sorted order e.g., find students in increasing

More information

The Right Read Optimization is Actually Write Optimization. Leif Walsh

The Right Read Optimization is Actually Write Optimization. Leif Walsh The Right Read Optimization is Actually Write Optimization Leif Walsh leif@tokutek.com The Right Read Optimization is Write Optimization Situation: I have some data. I want to learn things about the world,

More information

QuickCheck Mini for Elixir. Thomas Arts Quviq AB

QuickCheck Mini for Elixir. Thomas Arts Quviq AB QuickCheck Mini for Elixir Thomas Arts Quviq AB From Unit test to Property Most developers agree that writing unit tests is useful. but also quickly gets boring An example: Does Erlang lists:seq(n,m) do

More information

Ingo Brenckmann Jochen Kirsten Storage Technology Strategists SAS EMEA Copyright 2003, SAS Institute Inc. All rights reserved.

Ingo Brenckmann Jochen Kirsten Storage Technology Strategists SAS EMEA Copyright 2003, SAS Institute Inc. All rights reserved. Intelligent Storage Results from real life testing Ingo Brenckmann Jochen Kirsten Storage Technology Strategists SAS EMEA SAS Intelligent Storage components! OLAP Server! Scalable Performance Data Server!

More information

Topic 5: Examples and higher-order functions

Topic 5: Examples and higher-order functions CITS 3242 Programming Paradigms Topic 5: Examples and higher-order functions This lecture includes some larger examples in F# and introduces higher-functions. 1 Examples: append Now that we have lists,

More information

SEARCHING, SORTING, AND ASYMPTOTIC COMPLEXITY. Lecture 11 CS2110 Spring 2016

SEARCHING, SORTING, AND ASYMPTOTIC COMPLEXITY. Lecture 11 CS2110 Spring 2016 1 SEARCHING, SORTING, AND ASYMPTOTIC COMPLEXITY Lecture 11 CS2110 Spring 2016 Time spent on A2 2 Histogram: [inclusive:exclusive) [0:1): 0 [1:2): 24 ***** [2:3): 84 ***************** [3:4): 123 *************************

More information

SMBC: Engineering a Fast Solver in OCaml

SMBC: Engineering a Fast Solver in OCaml SMBC: Engineering a Fast Solver in OCaml Simon Cruanes Veridis, Inria Nancy https://cedeela.fr/~simon/ 28th of March, 2017 Simon Cruanes SMBC 28th of March, 2017 1 / 17 Summary 1 Presentation of SMBC (

More information

CS 31: Intro to Systems Caching. Martin Gagne Swarthmore College March 23, 2017

CS 31: Intro to Systems Caching. Martin Gagne Swarthmore College March 23, 2017 CS 1: Intro to Systems Caching Martin Gagne Swarthmore College March 2, 2017 Recall A cache is a smaller, faster memory, that holds a subset of a larger (slower) memory We take advantage of locality to

More information

Lab 4. 1 Comments. 2 Design. 2.1 Recursion vs Iteration. 2.2 Enhancements. Justin Ely

Lab 4. 1 Comments. 2 Design. 2.1 Recursion vs Iteration. 2.2 Enhancements. Justin Ely Lab 4 Justin Ely 615.202.81.FA15 Data Structures 06 December, 2015 1 Comments Sorting algorithms are a key component to computer science, not simply because sorting is a commonlyperformed task, but because

More information

Musings on Analysis of Measurements of a Real-Time Workload

Musings on Analysis of Measurements of a Real-Time Workload Musings on Analysis of Measurements of a Real-Time Workload Analysis of real-time performance is often focused on the worst case "bad" value, such as maximum latency or maximum interrupt disabled time.

More information

Welcome to Part 3: Memory Systems and I/O

Welcome to Part 3: Memory Systems and I/O Welcome to Part 3: Memory Systems and I/O We ve already seen how to make a fast processor. How can we supply the CPU with enough data to keep it busy? We will now focus on memory issues, which are frequently

More information

Column-Stores vs. Row-Stores. How Different are they Really? Arul Bharathi

Column-Stores vs. Row-Stores. How Different are they Really? Arul Bharathi Column-Stores vs. Row-Stores How Different are they Really? Arul Bharathi Authors Daniel J.Abadi Samuel R. Madden Nabil Hachem 2 Contents Introduction Row Oriented Execution Column Oriented Execution Column-Store

More information

It s good to be here... I almost wasn t. Beautiful Tests by Bruce A. Tate icanmakeitbe*er

It s good to be here... I almost wasn t. Beautiful Tests by Bruce A. Tate icanmakeitbe*er It s good to be here... I almost wasn t. Beautiful Tests by Bruce A. Tate icanmakeitbe*er Test all of your code with beautiful, dry, fast tests Test all of your code with beautiful, dry, fast tests Many

More information

PostgreSQL Query Optimization. Step by step techniques. Ilya Kosmodemiansky

PostgreSQL Query Optimization. Step by step techniques. Ilya Kosmodemiansky PostgreSQL Query Optimization Step by step techniques Ilya Kosmodemiansky (ik@) Agenda 2 1. What is a slow query? 2. How to chose queries to optimize? 3. What is a query plan? 4. Optimization tools 5.

More information

CSE 530A. Query Planning. Washington University Fall 2013

CSE 530A. Query Planning. Washington University Fall 2013 CSE 530A Query Planning Washington University Fall 2013 Scanning When finding data in a relation, we've seen two types of scans Table scan Index scan There is a third common way Bitmap scan Bitmap Scans

More information

PS2 out today. Lab 2 out today. Lab 1 due today - how was it?

PS2 out today. Lab 2 out today. Lab 1 due today - how was it? 6.830 Lecture 7 9/25/2017 PS2 out today. Lab 2 out today. Lab 1 due today - how was it? Project Teams Due Wednesday Those of you who don't have groups -- send us email, or hand in a sheet with just your

More information

Data Clustering on the Parallel Hadoop MapReduce Model. Dimitrios Verraros

Data Clustering on the Parallel Hadoop MapReduce Model. Dimitrios Verraros Data Clustering on the Parallel Hadoop MapReduce Model Dimitrios Verraros Overview The purpose of this thesis is to implement and benchmark the performance of a parallel K- means clustering algorithm on

More information

PebblesDB: Building Key-Value Stores using Fragmented Log Structured Merge Trees

PebblesDB: Building Key-Value Stores using Fragmented Log Structured Merge Trees PebblesDB: Building Key-Value Stores using Fragmented Log Structured Merge Trees Pandian Raju 1, Rohan Kadekodi 1, Vijay Chidambaram 1,2, Ittai Abraham 2 1 The University of Texas at Austin 2 VMware Research

More information

Lecture 16. Today: Start looking into memory hierarchy Cache$! Yay!

Lecture 16. Today: Start looking into memory hierarchy Cache$! Yay! Lecture 16 Today: Start looking into memory hierarchy Cache$! Yay! Note: There are no slides labeled Lecture 15. Nothing omitted, just that the numbering got out of sequence somewhere along the way. 1

More information

Data can be in the form of numbers, words, measurements, observations or even just descriptions of things.

Data can be in the form of numbers, words, measurements, observations or even just descriptions of things. + What is Data? Data is a collection of facts. Data can be in the form of numbers, words, measurements, observations or even just descriptions of things. In most cases, data needs to be interpreted and

More information

Look at all these toys!

Look at all these toys! Look at all these toys! Help it s Ruby! All alone Is Ruby dying? Where do Rubyists go? Where do Rubyists go? Tobias Pfeiffer @PragTob pragtob.info 673 Responses First Rails Release Rails 1.0 Why did

More information

TAIL RECURSION, SCOPE, AND PROJECT 4 11

TAIL RECURSION, SCOPE, AND PROJECT 4 11 TAIL RECURSION, SCOPE, AND PROJECT 4 11 COMPUTER SCIENCE 61A Noveber 12, 2012 1 Tail Recursion Today we will look at Tail Recursion and Tail Call Optimizations in Scheme, and how they relate to iteration

More information

DB Export/Import/Generate data tool

DB Export/Import/Generate data tool DB Export/Import/Generate data tool Main functions: quick connection to any database using defined UDL files show list of available tables and/or queries show data from selected table with possibility

More information

CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims. Lecture 10: Asymptotic Complexity and

CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims. Lecture 10: Asymptotic Complexity and CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims Lecture 10: Asymptotic Complexity and What Makes a Good Algorithm? Suppose you have two possible algorithms or

More information

Chapter 3 - Displaying and Summarizing Quantitative Data

Chapter 3 - Displaying and Summarizing Quantitative Data Chapter 3 - Displaying and Summarizing Quantitative Data 3.1 Graphs for Quantitative Data (LABEL GRAPHS) August 25, 2014 Histogram (p. 44) - Graph that uses bars to represent different frequencies or relative

More information

Becoming a better developer with explain

Becoming a better developer with explain Becoming a better developer with explain Understanding Postgres Query planner Louise Grandjonc About me Louise Grandjonc (louise@ulule.com) Lead developer at Ulule (www.ulule.com) Python / Django developer

More information

ECE 2574: Data Structures and Algorithms - Big-O Notation. C. L. Wyatt

ECE 2574: Data Structures and Algorithms - Big-O Notation. C. L. Wyatt ECE 2574: Data Structures and Algorithms - Big-O Notation C. L. Wyatt Today we will look at a common way algorithms are described, as an upper-bound on their growth rate functions. These are used to categorize

More information

Plot SIZE. How will execution time grow with SIZE? Actual Data. int array[size]; int A = 0;

Plot SIZE. How will execution time grow with SIZE? Actual Data. int array[size]; int A = 0; How will execution time grow with SIZE? int array[size]; int A = ; for (int i = ; i < ; i++) { for (int j = ; j < SIZE ; j++) { A += array[j]; } TIME } Plot SIZE Actual Data 45 4 5 5 Series 5 5 4 6 8 Memory

More information

Learn Functional Programming with Elixir

Learn Functional Programming with Elixir Extracted from: Learn Functional Programming with Elixir New Foundations for a New World This PDF file contains pages extracted from Learn Functional Programming with Elixir, published by the Pragmatic

More information

Oracle Platform Performance Baseline Oracle 12c on Hitachi VSP G1000. Benchmark Report December 2014

Oracle Platform Performance Baseline Oracle 12c on Hitachi VSP G1000. Benchmark Report December 2014 Oracle Platform Performance Baseline Oracle 12c on Hitachi VSP G1000 Benchmark Report December 2014 Contents 1 System Configuration 2 Introduction into Oracle Platform Performance Tests 3 Storage Benchmark

More information

Question 7.11 Show how heapsort processes the input:

Question 7.11 Show how heapsort processes the input: Question 7.11 Show how heapsort processes the input: 142, 543, 123, 65, 453, 879, 572, 434, 111, 242, 811, 102. Solution. Step 1 Build the heap. 1.1 Place all the data into a complete binary tree in the

More information

STA Module 2B Organizing Data and Comparing Distributions (Part II)

STA Module 2B Organizing Data and Comparing Distributions (Part II) STA 2023 Module 2B Organizing Data and Comparing Distributions (Part II) Learning Objectives Upon completing this module, you should be able to 1 Explain the purpose of a measure of center 2 Obtain and

More information

STA Learning Objectives. Learning Objectives (cont.) Module 2B Organizing Data and Comparing Distributions (Part II)

STA Learning Objectives. Learning Objectives (cont.) Module 2B Organizing Data and Comparing Distributions (Part II) STA 2023 Module 2B Organizing Data and Comparing Distributions (Part II) Learning Objectives Upon completing this module, you should be able to 1 Explain the purpose of a measure of center 2 Obtain and

More information

Chapter 6: DESCRIPTIVE STATISTICS

Chapter 6: DESCRIPTIVE STATISTICS Chapter 6: DESCRIPTIVE STATISTICS Random Sampling Numerical Summaries Stem-n-Leaf plots Histograms, and Box plots Time Sequence Plots Normal Probability Plots Sections 6-1 to 6-5, and 6-7 Random Sampling

More information

Getting Started With the Cisco PAM Desktop Software

Getting Started With the Cisco PAM Desktop Software CHAPTER 3 Getting Started With the Cisco PAM Desktop Software This chapter describes how to install the Cisco PAM desktop client software, log on to Cisco PAM, and begin configuring access control features

More information

User Perspective. Module III: System Perspective. Module III: Topics Covered. Module III Overview of Storage Structures, QP, and TM

User Perspective. Module III: System Perspective. Module III: Topics Covered. Module III Overview of Storage Structures, QP, and TM Module III Overview of Storage Structures, QP, and TM Sharma Chakravarthy UT Arlington sharma@cse.uta.edu http://www2.uta.edu/sharma base Management Systems: Sharma Chakravarthy Module I Requirements analysis

More information

CS 31: Intro to Systems Caching. Kevin Webb Swarthmore College March 24, 2015

CS 31: Intro to Systems Caching. Kevin Webb Swarthmore College March 24, 2015 CS 3: Intro to Systems Caching Kevin Webb Swarthmore College March 24, 205 Reading Quiz Abstraction Goal Reality: There is no one type of memory to rule them all! Abstraction: hide the complex/undesirable

More information

The MapReduce Abstraction

The MapReduce Abstraction The MapReduce Abstraction Parallel Computing at Google Leverages multiple technologies to simplify large-scale parallel computations Proprietary computing clusters Map/Reduce software library Lots of other

More information

Creating Ultra-fast Realtime Apps and Microservices with Java. Markus Kett, CEO Jetstream Technologies

Creating Ultra-fast Realtime Apps and Microservices with Java. Markus Kett, CEO Jetstream Technologies Creating Ultra-fast Realtime Apps and Microservices with Java Markus Kett, CEO Jetstream Technologies #NoDBMSApplications #JetstreamDB About me: Markus Kett Living in Regensburg, Germany Working with Java

More information

From Reproducibility Problems to Improvements: A journey

From Reproducibility Problems to Improvements: A journey From Reproducibility Problems to Improvements: A journey Holger Eichelberger, Aike Sass, Klaus Schmid {eichelberger, schmid}@sse.uni-hildesheim.de sassai@uni-hildesheim.de Software Systems Engineering

More information

Automatic Programming: How Far Can Machines Go? Hila Peleg Technion

Automatic Programming: How Far Can Machines Go? Hila Peleg Technion Automatic Programming: How Far Can Machines Go? Hila Peleg Technion Laziness Laziness Impatience Laziness Impatience Hubris Automatic Programming Clean up my spreadsheet! Right away, boss! Program synthesis

More information

Practical 2: Using Minitab (not assessed, for practice only!)

Practical 2: Using Minitab (not assessed, for practice only!) Practical 2: Using Minitab (not assessed, for practice only!) Instructions 1. Read through the instructions below for Accessing Minitab. 2. Work through all of the exercises on this handout. If you need

More information

Cache introduction. April 16, Howard Huang 1

Cache introduction. April 16, Howard Huang 1 Cache introduction We ve already seen how to make a fast processor. How can we supply the CPU with enough data to keep it busy? The rest of CS232 focuses on memory and input/output issues, which are frequently

More information

No. of blue jelly beans No. of bags

No. of blue jelly beans No. of bags Math 167 Ch5 Review 1 (c) Janice Epstein CHAPTER 5 EXPLORING DATA DISTRIBUTIONS A sample of jelly bean bags is chosen and the number of blue jelly beans in each bag is counted. The results are shown in

More information

The Actor Model. CSCI 5828: Foundations of Software Engineering Lecture 13 10/04/2016

The Actor Model. CSCI 5828: Foundations of Software Engineering Lecture 13 10/04/2016 The Actor Model CSCI 5828: Foundations of Software Engineering Lecture 13 10/04/2016 1 Goals Introduce the Actor Model of Concurrency isolation, message passing, message patterns Present examples from

More information

AMath 483/583 Lecture 11

AMath 483/583 Lecture 11 AMath 483/583 Lecture 11 Outline: Computer architecture Cache considerations Fortran optimization Reading: S. Goedecker and A. Hoisie, Performance Optimization of Numerically Intensive Codes, SIAM, 2001.

More information

External Sorting. Chapter 13. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1

External Sorting. Chapter 13. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 External Sorting Chapter 13 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Why Sort? A classic problem in computer science! Data requested in sorted order e.g., find students in increasing

More information

AMath 483/583 Lecture 11. Notes: Notes: Comments on Homework. Notes: AMath 483/583 Lecture 11

AMath 483/583 Lecture 11. Notes: Notes: Comments on Homework. Notes: AMath 483/583 Lecture 11 AMath 483/583 Lecture 11 Outline: Computer architecture Cache considerations Fortran optimization Reading: S. Goedecker and A. Hoisie, Performance Optimization of Numerically Intensive Codes, SIAM, 2001.

More information

Create a bar graph that displays the data from the frequency table in Example 1. See the examples on p Does our graph look different?

Create a bar graph that displays the data from the frequency table in Example 1. See the examples on p Does our graph look different? A frequency table is a table with two columns, one for the categories and another for the number of times each category occurs. See Example 1 on p. 247. Create a bar graph that displays the data from the

More information

Table of Contents (As covered from textbook)

Table of Contents (As covered from textbook) Table of Contents (As covered from textbook) Ch 1 Data and Decisions Ch 2 Displaying and Describing Categorical Data Ch 3 Displaying and Describing Quantitative Data Ch 4 Correlation and Linear Regression

More information

Parallel Python. Andrew Perry University of Massachusetts at Dartmouth

Parallel Python. Andrew Perry University of Massachusetts at Dartmouth Parallel Python Andrew Perry University of Massachusetts at Dartmouth 1 Introduction In my project I attempted to implement a simple sieve for finding prime numbers. It wasn t my intent to have an initially

More information

STAT 3743 PROBABILITY & STATISTICS FALL 2010 KERNS. Exam I

STAT 3743 PROBABILITY & STATISTICS FALL 2010 KERNS. Exam I STAT 3743 PROBABILITY & STATISTICS FALL 2010 KERNS Exam I Name: ANSWER KEY Note: the questions are randomly generated so these may (not) exactly match those on your paper. The answers below are for these

More information

CSE 373: Data Structures and Algorithms. Memory and Locality. Autumn Shrirang (Shri) Mare

CSE 373: Data Structures and Algorithms. Memory and Locality. Autumn Shrirang (Shri) Mare CSE 373: Data Structures and Algorithms Memory and Locality Autumn 2018 Shrirang (Shri) Mare shri@cs.washington.edu Thanks to Kasey Champion, Ben Jones, Adam Blank, Michael Lee, Evan McCarty, Robbie Weber,

More information

JAVA PERFORMANCE. PR SW2 S18 Dr. Prähofer DI Leopoldseder

JAVA PERFORMANCE. PR SW2 S18 Dr. Prähofer DI Leopoldseder JAVA PERFORMANCE PR SW2 S18 Dr. Prähofer DI Leopoldseder OUTLINE 1. What is performance? 1. Benchmarking 2. What is Java performance? 1. Interpreter vs JIT 3. Tools to measure performance 4. Memory Performance

More information

9 POINTS TO A GOOD LINE GRAPH

9 POINTS TO A GOOD LINE GRAPH NAME: PD: DATE: 9 POINTS TO A GOOD LINE GRAPH - 2013 1. Independent Variable on the HORIZONTAL (X) AXIS RANGE DIVIDED BY SPACES and round up to nearest usable number to spread out across the paper. LABELED

More information

Performance Comparison of NOSQL Database Cassandra and SQL Server for Large Databases

Performance Comparison of NOSQL Database Cassandra and SQL Server for Large Databases Performance Comparison of NOSQL Database Cassandra and SQL Server for Large Databases Khalid Mahmood Shaheed Zulfiqar Ali Bhutto Institute of Science and Technology, Karachi Pakistan khalidmdar@yahoo.com

More information

LazyBase: Trading freshness and performance in a scalable database

LazyBase: Trading freshness and performance in a scalable database LazyBase: Trading freshness and performance in a scalable database (EuroSys 2012) Jim Cipar, Greg Ganger, *Kimberly Keeton, *Craig A. N. Soules, *Brad Morrey, *Alistair Veitch PARALLEL DATA LABORATORY

More information

CSE3322 Programming Languages and Implementation

CSE3322 Programming Languages and Implementation Monash University School of Computer Science & Software Engineering Exam 2005 CSE3322 Programming Languages and Implementation Total Time Allowed: 3 Hours 1. Reading time is of 10 minutes duration. 2.

More information

Rails Performance. Michael Koziarski

Rails Performance. Michael Koziarski Rails Performance Michael Koziarski michael@koziarski.com Rails Performance Relax Programmers Love Optimisation Science Based Objective Provable Opportunity Cost Is this optimisation really the best use

More information

Research. Eurex NTA Timings 06 June Dennis Lohfert.

Research. Eurex NTA Timings 06 June Dennis Lohfert. Research Eurex NTA Timings 06 June 2013 Dennis Lohfert www.ion.fm 1 Introduction Eurex introduced a new trading platform that represents a radical departure from its previous platform based on OpenVMS

More information

Department of Computer Science Admission Test for PhD Program. Part I Time : 30 min Max Marks: 15

Department of Computer Science Admission Test for PhD Program. Part I Time : 30 min Max Marks: 15 Department of Computer Science Admission Test for PhD Program Part I Time : 30 min Max Marks: 15 Each Q carries 1 marks. ¼ mark will be deducted for every wrong answer. Part II of only those candidates

More information

Advanced Database Systems

Advanced Database Systems Lecture II Storage Layer Kyumars Sheykh Esmaili Course s Syllabus Core Topics Storage Layer Query Processing and Optimization Transaction Management and Recovery Advanced Topics Cloud Computing and Web

More information

Statistics Case Study 2000 M. J. Clancy and M. C. Linn

Statistics Case Study 2000 M. J. Clancy and M. C. Linn Statistics Case Study 2000 M. J. Clancy and M. C. Linn Problem Write and test functions to compute the following statistics for a nonempty list of numeric values: The mean, or average value, is computed

More information

Parallel DBs. April 25, 2017

Parallel DBs. April 25, 2017 Parallel DBs April 25, 2017 1 Why Scale Up? Scan of 1 PB at 300MB/s (SATA r2 Limit) (x1000) ~1 Hour ~3.5 Seconds 2 Data Parallelism Replication Partitioning A A A A B C 3 Operator Parallelism Pipeline

More information

Descriptive Statistics and Graphing

Descriptive Statistics and Graphing Anatomy and Physiology Page 1 of 9 Measures of Central Tendency Descriptive Statistics and Graphing Measures of central tendency are used to find typical numbers in a data set. There are different ways

More information

Computer Science 210 Data Structures Siena College Fall Topic Notes: Complexity and Asymptotic Analysis

Computer Science 210 Data Structures Siena College Fall Topic Notes: Complexity and Asymptotic Analysis Computer Science 210 Data Structures Siena College Fall 2017 Topic Notes: Complexity and Asymptotic Analysis Consider the abstract data type, the Vector or ArrayList. This structure affords us the opportunity

More information

Myths and Realities: The Performance Impact of Garbage Collection

Myths and Realities: The Performance Impact of Garbage Collection Myths and Realities: The Performance Impact of Garbage Collection Tapasya Patki February 17, 2011 1 Motivation Automatic memory management has numerous software engineering benefits from the developer

More information

File Structures and Indexing

File Structures and Indexing File Structures and Indexing CPS352: Database Systems Simon Miner Gordon College Last Revised: 10/11/12 Agenda Check-in Database File Structures Indexing Database Design Tips Check-in Database File Structures

More information

Debugging in LISP. trace causes a trace to be printed for a function when it is called

Debugging in LISP. trace causes a trace to be printed for a function when it is called trace causes a trace to be printed for a function when it is called ;;; a function that works like reverse (defun rev (list) (cons (first (last list)) (rev (butlast list)))) USER: (trace rev) ; note trace

More information

High Performance Computing on MapReduce Programming Framework

High Performance Computing on MapReduce Programming Framework International Journal of Private Cloud Computing Environment and Management Vol. 2, No. 1, (2015), pp. 27-32 http://dx.doi.org/10.21742/ijpccem.2015.2.1.04 High Performance Computing on MapReduce Programming

More information

Oracle Performance on M5000 with F20 Flash Cache. Benchmark Report September 2011

Oracle Performance on M5000 with F20 Flash Cache. Benchmark Report September 2011 Oracle Performance on M5000 with F20 Flash Cache Benchmark Report September 2011 Contents 1 About Benchware 2 Flash Cache Technology 3 Storage Performance Tests 4 Conclusion copyright 2011 by benchware.ch

More information

Guideline for the installation of C-MOR Video Surveillance Virtual Machine on VMware ESX Server

Guideline for the installation of C-MOR Video Surveillance Virtual Machine on VMware ESX Server This guideline illustrates the installation of the C-MOR Video Surveillance Virtual Machine on VMware ESX Server. This manual applies to C-MOR version 4 with 64 bit operating system. First download the

More information

(Provisional) Lecture 32: Estimated Value, Minimax, Functional Data 10:00 AM, Nov 20, 2017

(Provisional) Lecture 32: Estimated Value, Minimax, Functional Data 10:00 AM, Nov 20, 2017 Integrated Introduction to Computer Science Hughes (Provisional) Lecture 32: Estimated Value, Minimax, Functional Data 10:00 AM, Nov 20, 2017 Contents 1 Estimated Value and Search Subtrees 1 2 Minimax

More information

Lecture 11. Lecture 11: External Sorting

Lecture 11. Lecture 11: External Sorting Lecture 11 Lecture 11: External Sorting Lecture 11 Announcements 1. Midterm Review: This Friday! 2. Project Part #2 is out. Implement CLOCK! 3. Midterm Material: Everything up to Buffer management. 1.

More information

The Optimal CPU and Interconnect for an HPC Cluster

The Optimal CPU and Interconnect for an HPC Cluster 5. LS-DYNA Anwenderforum, Ulm 2006 Cluster / High Performance Computing I The Optimal CPU and Interconnect for an HPC Cluster Andreas Koch Transtec AG, Tübingen, Deutschland F - I - 15 Cluster / High Performance

More information

Dtb Database Systems. Announcement

Dtb Database Systems. Announcement Dtb Database Systems ( 資料庫系統 ) December 10, 2008 Lecture #11 1 Announcement Assignment #5 will be out on the course webpage today. 2 1 External Sorting Chapter 13 3 Why learn sorting again? O (n*n): bubble,

More information