Skip to content

Optimize Enum.to_list for ranges, closes #12383 #12384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

fuelen
Copy link
Contributor

@fuelen fuelen commented Feb 8, 2023

Banchee report
Operating System: Linux
CPU Information: AMD Ryzen 7 PRO 6850U with Radeon Graphics
Number of Available Cores: 16
Available memory: 30.13 GB
Elixir 1.15.0-dev
Erlang 25.2

Benchmark suite executing with the following configuration:
warmup: 2 s
time: 10 s
memory time: 2 s
reduction time: 0 ns
parallel: 1
inputs: 100, 1000, 100_000, 10_000
Estimated total run time: 1.87 min

Benchmarking :list.seq with input 100 ...
Benchmarking :list.seq with input 1000 ...
Benchmarking :list.seq with input 100_000 ...
Benchmarking :list.seq with input 10_000 ...
Benchmarking Range + Enum.to_list with input 100 ...
Benchmarking Range + Enum.to_list with input 1000 ...
Benchmarking Range + Enum.to_list with input 100_000 ...
Benchmarking Range + Enum.to_list with input 10_000 ...

##### With input 100 #####
Name                           ips        average  deviation         median         99th %
:list.seq                 695.70 K        1.44 μs   ±931.48%        1.40 μs        2.38 μs
Range + Enum.to_list      676.80 K        1.48 μs   ±992.20%        1.40 μs        2.44 μs

Comparison: 
:list.seq                 695.70 K
Range + Enum.to_list      676.80 K - 1.03x slower +0.0401 μs

Memory usage statistics:

Name                    Memory usage
:list.seq                    1.56 KB
Range + Enum.to_list         1.66 KB - 1.06x memory usage +0.0938 KB

**All measurements for memory usage were the same**

##### With input 1000 #####
Name                           ips        average  deviation         median         99th %
Range + Enum.to_list      378.06 K        2.65 μs   ±771.47%        2.38 μs        5.59 μs
:list.seq                 341.17 K        2.93 μs   ±794.98%        2.44 μs        6.29 μs

Comparison: 
Range + Enum.to_list      378.06 K
:list.seq                 341.17 K - 1.11x slower +0.29 μs

Memory usage statistics:

Name                    Memory usage
Range + Enum.to_list        15.72 KB
:list.seq                   15.63 KB - 0.99x memory usage -0.09375 KB

**All measurements for memory usage were the same**

##### With input 100_000 #####
Name                           ips        average  deviation         median         99th %
:list.seq                   3.92 K      255.41 μs    ±43.94%      347.81 μs      423.93 μs
Range + Enum.to_list        3.08 K      324.34 μs     ±6.98%      318.76 μs      403.85 μs

Comparison: 
:list.seq                   3.92 K
Range + Enum.to_list        3.08 K - 1.27x slower +68.93 μs

Memory usage statistics:

Name                    Memory usage
:list.seq                    1.53 MB
Range + Enum.to_list         1.53 MB - 1.00x memory usage +0.00009 MB

**All measurements for memory usage were the same**

##### With input 10_000 #####
Name                           ips        average  deviation         median         99th %
Range + Enum.to_list       62.95 K       15.89 μs    ±89.96%       12.43 μs       44.35 μs
:list.seq                  50.59 K       19.77 μs    ±78.15%       16.20 μs       39.60 μs

Comparison: 
Range + Enum.to_list       62.95 K
:list.seq                  50.59 K - 1.24x slower +3.88 μs

Memory usage statistics:

Name                    Memory usage
Range + Enum.to_list       156.34 KB
:list.seq                  156.25 KB - 1.00x memory usage -0.09375 KB

**All measurements for memory usage were the same**

@josevalim josevalim merged commit 99b79af into elixir-lang:main Feb 8, 2023
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@fuelen fuelen deleted the optimize_enum_to_list_for_ranges branch February 8, 2023 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants