# emacs-30.1-on-android-termux-vs-android-linux-terminal.txt -rw-r--r-- 7.8 KiB View raw
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# -*- mode: org; mode: org-edna; mode: visual-line; mode: flyspell; -*-

#+TITLE: Emacs 30.1 on Android: Termux vs. Android Linux Terminal
#+STARTUP: align

* Purpose and Motivation
[2025-03-08 Sat 18:21]

These are the results of running the elisp-benchmarks package against
two versions of emacs 30.1 on identical hardware, a Pixel 9 Pro XL
Android phone.  The reason for running the benchmark is to compare two
different runtime environments: one is Termux, which is thin
virtualization layer atop the Android underpinnings; the other is the
new Android Linux Terminal shipped in the Android 15 March 2025
feature drop, which is effectively a fully virtualized aarch64 Linux
subsystem running atop the Android operating system.

The comparison is interesting because the version of emacs 30.1
packaged by Termux explicitly lacks the native-compilation feature
built atop libgccjit, whereas the version of emacs 30.1 that I
self-compiled within the Android Linux Terminal includes the
native-comp library.

Will the extra indirection of the virtualization layer soak up all the
performance advantages offered by native elisp compilation?  Let's
find out!

* Methodology

I installed the elisp-benchmarks suite with the straight.el package
manager by running:

    M-x straight-use-package <ret> elisp-benchmarks <ret>

This invocation cloned the elisp-benchmarks repo from:

    https://github.com/emacs-straight/elisp-benchmarks.git

...as of commit d4f5245b778842941ab046bff3274804d5f529a3 .  On the
version of emacs packaged by termux, this byte-compiled the benchmarks
at installation time; on the self-compiled emacs this also generated
native-compiled files under ~/.emacs.d/eln-cache/... .  I waited for
the compilation process to fully complete before proceeding.

I then backgrounded emacs with C-z and, per the instructions in the
header of the elisp-benchmarks.el file itself, I ran:

    emacs -batch -l ~/.emacs.d/straight/repos/elisp-benchmarks/elisp-benchmarks.el -f elisp-benchmarks-run

The output of:

    (describe-variable 'system-configuration-options)
    (describe-variable 'system-configuration-features)

...for each emacs is as follows:

** system-configuration-options

*** termux emacs

    --disable-dependency-tracking
    --prefix=/data/data/com.termux/files/usr
    --libdir=/data/data/com.termux/files/usr/lib
    --sbindir=/data/data/com.termux/files/usr/bin
    --disable-rpath
    --disable-rpath-hack
    --host=aarch64-linux-android
    --disable-autodepend
    --with-dumping=none
    --with-gif=no
    --with-gnutls
    --with-jpeg=no
    --with-modules
    --with-pdumper=yes
    --with-png=no
    --with-tiff=no
    --with-xml2
    --with-xpm=no
    --with-tree-sitter
    --without-dbus
    --without-gconf
    --without-gsettings
    --without-lcms2
    --without-selinux
    --without-x
    emacs_cv_alternate_stack=yes
    emacs_cv_sanitize_address=yes
    emacs_cv_prog_cc_no_pie=no
    ac_cv_lib_elf_elf_begin=no
    gl_cv_func_dup2_works=no
    ac_cv_func_setrlimit=no
    --disable-nls
    --enable-shared
    --enable-static
    --libexecdir=/data/data/com.termux/files/usr/libexec
    'CFLAGS= -fstack-protector-strong -Oz'
    'CPPFLAGS= -isystem/data/data/com.termux/files/usr/include'
    'LDFLAGS=-L/data/data/com.termux/files/usr/lib
    -Wl,-rpath=/data/data/com.termux/files/usr/lib
    -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now'

*** native emacs

    --prefix=/home/droid
    --with-native-compilation=yes
    --with-tree-sitter

** system-configuration-features

*** termux emacs

    GMP GNUTLS LIBXML2 MODULES NOTIFY INOTIFY PDUMPER
    SECCOMP SQLITE3 THREADS TREE_SITTER XIM ZLIB

*** native emacs

    GMP GNUTLS LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER
    SECCOMP SOUND SQLITE3 THREADS TREE_SITTER ZLIB

* Performance - emacs 30.1 packaged by Termux

| test               | non-gc (s) | gc (s) | gcs | total (s) | err (s) |
|--------------------+------------+--------+-----+-----------+---------|
| bubble             |       2.05 |   0.42 |  25 |      2.46 |    0.03 |
| bubble-no-cons     |       5.19 |   0.00 |   0 |      5.19 |    0.13 |
| bytecomp           |       1.63 |   0.15 |   7 |      1.78 |    0.06 |
| dhrystone          |       3.48 |   0.00 |   0 |      3.48 |    0.07 |
| eieio              |       1.20 |   0.16 |   9 |      1.36 |    0.03 |
| fibn               |       1.30 |   0.00 |   0 |      1.30 |    0.04 |
| fibn-named-let     |       1.73 |   0.00 |   0 |      1.73 |    0.03 |
| fibn-rec           |       2.12 |   0.00 |   0 |      2.12 |    0.06 |
| fibn-tc            |       2.13 |   0.00 |   0 |      2.13 |    0.05 |
| flet               |       4.75 |   0.00 |   0 |      4.75 |    0.10 |
| font-lock          |       0.62 |   0.02 |   1 |      0.64 |    0.01 |
| inclist            |       7.00 |   0.00 |   0 |      7.00 |    0.09 |
| inclist-type-hints |       6.99 |   0.00 |   0 |      6.99 |    0.10 |
| listlen-tc         |       2.26 |   0.00 |   0 |      2.26 |    0.03 |
| map-closure        |       4.88 |   0.00 |   0 |      4.88 |    0.07 |
| nbody              |       2.91 |   0.77 |  44 |      3.68 |    0.08 |
| pack-unpack        |       0.36 |   0.04 |   2 |      0.39 |    0.01 |
| pack-unpack-old    |       0.89 |   0.07 |   4 |      0.96 |    0.02 |
| pcase              |       5.76 |   0.00 |   0 |      5.76 |    0.08 |
| pidigits           |       5.16 |   2.11 |  22 |      7.27 |    0.63 |
| scroll             |       0.56 |   0.00 |   0 |      0.56 |    0.01 |
| smie               |       1.90 |   0.04 |   2 |      1.94 |    0.03 |
|--------------------+------------+--------+-----+-----------+---------|
| total              |      64.85 |   3.77 | 116 |     68.62 |    0.69 |

* Performance - emacs 30.1 within Android Linux Terminal, with native-comp enabled

| test               | non-gc (s) | gc (s) | gcs | total (s) | err (s) |
|--------------------+------------+--------+-----+-----------+---------|
| bubble             |       0.94 |   0.06 |   1 |      1.00 |    0.45 |
| bubble-no-cons     |       0.96 |   0.00 |   0 |      0.96 |    0.01 |
| bytecomp           |       1.30 |   0.15 |   5 |      1.45 |    0.02 |
| dhrystone          |       2.14 |   0.00 |   0 |      2.14 |    0.00 |
| eieio              |       1.05 |   0.18 |   7 |      1.23 |    0.00 |
| fibn               |       0.00 |   0.00 |   0 |      0.00 |    0.00 |
| fibn-named-let     |       1.41 |   0.00 |   0 |      1.41 |    0.00 |
| fibn-rec           |       0.00 |   0.00 |   0 |      0.00 |    0.00 |
| fibn-tc            |       0.00 |   0.00 |   0 |      0.00 |    0.00 |
| flet               |       1.60 |   0.00 |   0 |      1.60 |    0.01 |
| font-lock          |       0.67 |   0.02 |   1 |      0.69 |    0.00 |
| inclist            |       1.41 |   0.00 |   0 |      1.41 |    0.00 |
| inclist-type-hints |       1.19 |   0.00 |   0 |      1.19 |    0.00 |
| listlen-tc         |       0.17 |   0.00 |   0 |      0.17 |    0.00 |
| map-closure        |       6.45 |   0.00 |   0 |      6.45 |    0.02 |
| nbody              |       1.82 |   0.15 |   1 |      1.96 |    0.59 |
| pack-unpack        |       0.36 |   0.05 |   2 |      0.41 |    0.00 |
| pack-unpack-old    |       1.10 |   0.08 |   3 |      1.18 |    0.03 |
| pcase              |       2.39 |   0.00 |   0 |      2.39 |    0.01 |
| pidigits           |       3.85 |   1.43 |  18 |      5.29 |    0.10 |
| scroll             |       0.64 |   0.00 |   0 |      0.64 |    0.00 |
| smie               |       1.56 |   0.06 |   2 |      1.62 |    0.00 |
|--------------------+------------+--------+-----+-----------+---------|
| total              |      31.04 |   2.18 |  40 |     33.22 |    0.75 |

* Results

Well that is a conclusive result: emacs running within a fully
virtualized Linux guest on the exact same hardware trounces
termux-emacs by running the benchmark suite roughly twice as fast.
I did not expect that result, but I am pleased with it!