|
| 1 | +➜ sql git:(optimize-sql-generation) ✗ mix sql.bench |
| 2 | +Compiling 1 file (.ex) |
| 3 | +Generated sql app |
| 4 | +Operating System: macOS |
| 5 | +CPU Information: Apple M1 Max |
| 6 | +Number of Available Cores: 10 |
| 7 | +Available memory: 64 GB |
| 8 | +Elixir 1.18.0 |
| 9 | +Erlang 27.2 |
| 10 | +JIT enabled: true |
| 11 | + |
| 12 | +Benchmark suite executing with the following configuration: |
| 13 | +warmup: 2 s |
| 14 | +time: 10 s |
| 15 | +memory time: 2 s |
| 16 | +reduction time: 0 ns |
| 17 | +parallel: 1 |
| 18 | +inputs: none specified |
| 19 | +Estimated total run time: 56 s |
| 20 | + |
| 21 | +Benchmarking Ecto.Repo.to_sql ... |
| 22 | +Benchmarking inspect ... |
| 23 | +Benchmarking to_sql ... |
| 24 | +Benchmarking to_stirng ... |
| 25 | +Calculating statistics... |
| 26 | +Formatting results... |
| 27 | + |
| 28 | +Name ips average deviation median 99th % |
| 29 | +to_sql 4.74 K 0.21 ms ±20.20% 0.20 ms 0.32 ms |
| 30 | +to_stirng 4.51 K 0.22 ms ±3.60% 0.22 ms 0.26 ms |
| 31 | +inspect 0.24 K 4.09 ms ±2.96% 4.09 ms 4.36 ms |
| 32 | +Ecto.Repo.to_sql 0.00757 K 132.03 ms ±1.45% 131.80 ms 139.43 ms |
| 33 | + |
| 34 | +Comparison: |
| 35 | +to_sql 4.74 K |
| 36 | +to_stirng 4.51 K - 1.05x slower +0.0108 ms |
| 37 | +inspect 0.24 K - 19.39x slower +3.88 ms |
| 38 | +Ecto.Repo.to_sql 0.00757 K - 626.20x slower +131.82 ms |
| 39 | + |
| 40 | +Memory usage statistics: |
| 41 | + |
| 42 | +Name Memory usage |
| 43 | +to_sql 0.38 MB |
| 44 | +to_stirng 0.153 MB - 0.40x memory usage -0.22888 MB |
| 45 | +inspect 4.88 MB - 12.80x memory usage +4.50 MB |
| 46 | +Ecto.Repo.to_sql 179.35 MB - 470.13x memory usage +178.97 MB |
| 47 | + |
| 48 | +**All measurements for memory usage were the same** |
| 49 | + |
| 50 | +➜ sql git:(optimize-sql-generation) ✗ mix sql.bench |
| 51 | +Compiling 1 file (.ex) |
| 52 | +Generated sql app |
| 53 | +Operating System: macOS |
| 54 | +CPU Information: Apple M1 Max |
| 55 | +Number of Available Cores: 10 |
| 56 | +Available memory: 64 GB |
| 57 | +Elixir 1.18.0 |
| 58 | +Erlang 27.2 |
| 59 | +JIT enabled: true |
| 60 | + |
| 61 | +Benchmark suite executing with the following configuration: |
| 62 | +warmup: 2 s |
| 63 | +time: 10 s |
| 64 | +memory time: 2 s |
| 65 | +reduction time: 0 ns |
| 66 | +parallel: 1 |
| 67 | +inputs: none specified |
| 68 | +Estimated total run time: 56 s |
| 69 | + |
| 70 | +Benchmarking ecto ... |
| 71 | +Benchmarking inspect ... |
| 72 | +Benchmarking to_sql ... |
| 73 | +Benchmarking to_stirng ... |
| 74 | +Calculating statistics... |
| 75 | +Formatting results... |
| 76 | + |
| 77 | +Name ips average deviation median 99th % |
| 78 | +to_stirng 27.59 36.24 ms ±0.75% 36.22 ms 37.21 ms |
| 79 | +to_sql 27.45 36.42 ms ±0.47% 36.39 ms 36.93 ms |
| 80 | +inspect 24.53 40.76 ms ±1.07% 40.75 ms 41.60 ms |
| 81 | +ecto 6.96 143.65 ms ±1.37% 143.36 ms 148.62 ms |
| 82 | + |
| 83 | +Comparison: |
| 84 | +to_stirng 27.59 |
| 85 | +to_sql 27.45 - 1.00x slower +0.181 ms |
| 86 | +inspect 24.53 - 1.12x slower +4.52 ms |
| 87 | +ecto 6.96 - 3.96x slower +107.41 ms |
| 88 | + |
| 89 | +Memory usage statistics: |
| 90 | + |
| 91 | +Name Memory usage |
| 92 | +to_stirng 4.50 MB |
| 93 | +to_sql 4.73 MB - 1.05x memory usage +0.23 MB |
| 94 | +inspect 9.23 MB - 2.05x memory usage +4.73 MB |
| 95 | +ecto 202.87 MB - 45.11x memory usage +198.37 MB |
| 96 | + |
| 97 | +**All measurements for memory usage were the same** |
0 commit comments