Skip to content

Benchmark in section 10.1 returning strange values #16

@mguimas

Description

@mguimas

Hi,

the benchmark in elixir_in_action_code_samples/ch10/profile_cache is returning the following results

$ iex -S mix
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Interactive Elixir (1.5.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Profiler.run(PageCache, 100000)

304625 reqs/sec

:ok
iex(2)> Profiler.run(PageCache, 100000, 100)

528910 reqs/sec

:ok
iex(3)>

Here are some more data:

iex(9)> Profiler.run(PageCache, 100000, 2)

305392 reqs/sec

:ok
iex(10)> Profiler.run(PageCache, 100000, 4)

389874 reqs/sec

:ok
iex(11)> Profiler.run(PageCache, 100000, 8)

324331 reqs/sec

:ok
iex(12)> Profiler.run(PageCache, 100000, 16)

360170 reqs/sec

:ok
iex(14)> Profiler.run(PageCache, 100000, 32)

381613 reqs/sec

:ok
iex(15)> Profiler.run(PageCache, 100000, 64)

460793 reqs/sec

:ok
iex(16)> Profiler.run(PageCache, 100000, 128)

534101 reqs/sec

:ok
iex(17)> Profiler.run(PageCache, 100000, 256)

543486 reqs/sec

:ok
iex(18)>

These are strange as instead of decreasing as in the book, the throughput is increasing?!
What am I doing wrong here?

I am with a Macbook Pro, 2.6 GHz Intel Core i5, 16 GB 1600 MHz DDR3, macOS Sierra 10.12.6, Erlang 20.2 and Elixir 1.5.2.

I had to change the code of the example to use Map instead of HashDict and to depend on Elixir 1.5.2 in mix.exs.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions