Subject: bug#41077: [feature/native-comp] virtual memory exhausted

From: Kévin Le Gouguec <[email-masked]>
Date: Mon, 11 May 2020 11:12:47 +0200

Ah, right; I don't know what I was thinking.  I guess I assumed that the
benchmarks covered Emacs subroutines, so not compiling the benchmark
sources would not have a big impact.  I got that completely backward 🤦

Andrea Corallo <[email-masked]> writes:

> Other option maybe quicker: you can manually native compile the
> benchmarcks and the native emacs instance should load them.
>
> You will see that when a .eln is loaded the message is a little
> different to indicate that.

I went with this option, using M-: (native-compile "foo.el").  I had one
last surprise: the native-compiled fibn test exhausts the laptop's
memory (2GB RAM + 2GB swap).  I recompiled fibn.eln setting comp-speed
to 1 and 0, but the result was the same.

Here are the results: except for pidigits, the improvements are quite
noticeable :)  I'll post a write-up (giving my hardware specs and
computing the speedups) to emacs-devel when I find the time.

* Results

** master

  | test           | non-gc avg (s) | gc avg (s) | gcs avg | tot avg (s) | tot avg err (s) |
  |----------------+----------------+------------+---------+-------------+-----------------|
  | bubble-no-cons |         122.06 |       0.22 |       4 |      122.28 |            0.43 |
  | bubble         |          49.22 |      26.59 |     491 |       75.81 |            0.18 |
  | fibn-rec       |          62.00 |       0.00 |       0 |       62.00 |            0.00 |
  | fibn-tc        |         133.97 |      87.95 |    1520 |      221.91 |            0.36 |
  | inclist        |         174.41 |       0.06 |       1 |      174.47 |            0.00 |
  | listlen-tc     |          68.04 |       0.00 |       0 |       68.04 |            0.02 |
  | pidigits       |          56.97 |      36.60 |     605 |       93.57 |            0.53 |
  |----------------+----------------+------------+---------+-------------+-----------------|
  | total          |         666.67 |     151.42 |    2621 |      818.08 |            0.79 |

** feature/native-comp

  | test           | non-gc avg (s) | gc avg (s) | gcs avg | tot avg (s) | tot avg err (s) |
  |----------------+----------------+------------+---------+-------------+-----------------|
  | bubble-no-cons |          24.53 |       0.22 |       4 |       24.75 |            0.02 |
  | bubble         |          17.83 |       5.79 |     100 |       23.62 |            0.27 |
  | fibn-rec       |          18.63 |       0.00 |       0 |       18.63 |            0.01 |
  | fibn-tc        |          67.39 |      86.45 |    1519 |      153.84 |            0.07 |
  | inclist        |          10.99 |       0.06 |       1 |       11.05 |            0.04 |
  | listlen-tc     |           0.82 |       0.00 |       0 |        0.82 |            0.00 |
  | pidigits       |          54.03 |      36.84 |     605 |       90.87 |            0.69 |
  |----------------+----------------+------------+---------+-------------+-----------------|
  | total          |         194.22 |     129.35 |    2229 |      323.57 |            0.75 |

Again, thanks for your help!