Commit bc3b4c084a4b4858319ba4843fae99b6fb77994a

Ran Benita 2014-10-02T22:03:28

Move benchmarks from tests to their own files in bench/ The tests only contain tests, and the benchmarks are more visible. Signed-off-by: Ran Benita <ran234@gmail.com>

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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
diff --git a/Makefile.am b/Makefile.am
index 01d39ce..0bae4ea 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -180,8 +180,7 @@ TESTS = \
 	test/rulescomp
 check_PROGRAMS = \
 	test/rmlvo-to-kccgst \
-	test/print-compiled-keymap \
-	test/bench-key-proc
+	test/print-compiled-keymap
 
 TESTS_LDADD = libtest.la
 
@@ -189,7 +188,7 @@ test_keysym_LDADD = $(TESTS_LDADD)
 test_filecomp_LDADD = $(TESTS_LDADD)
 test_context_LDADD = $(TESTS_LDADD)
 test_rules_file_CFLAGS = $(AM_CFLAGS) -Wno-declaration-after-statement
-test_rules_file_LDADD = $(TESTS_LDADD) -lrt
+test_rules_file_LDADD = $(TESTS_LDADD)
 test_stringcomp_LDADD = $(TESTS_LDADD)
 test_buffercomp_LDADD = $(TESTS_LDADD)
 test_log_LDADD = $(TESTS_LDADD)
@@ -197,10 +196,9 @@ test_atom_LDADD = $(TESTS_LDADD)
 test_utf8_LDADD = $(TESTS_LDADD)
 test_state_LDADD = $(TESTS_LDADD)
 test_keyseq_LDADD = $(TESTS_LDADD)
-test_rulescomp_LDADD = $(TESTS_LDADD) -lrt
+test_rulescomp_LDADD = $(TESTS_LDADD)
 test_rmlvo_to_kccgst_LDADD = $(TESTS_LDADD)
 test_print_compiled_keymap_LDADD = $(TESTS_LDADD)
-test_bench_key_proc_LDADD = $(TESTS_LDADD) -lrt
 
 if BUILD_LINUX_TESTS
 check_PROGRAMS += \
@@ -230,6 +228,20 @@ endif ENABLE_X11
 check_PROGRAMS += $(TESTS)
 
 ##
+# Benchmarks
+##
+
+BENCH_LDADD = $(TESTS_LDADD) -lrt
+
+check_PROGRAMS += \
+	bench/key-proc \
+	bench/rules \
+	bench/rulescomp
+bench_key_proc_LDADD = $(BENCH_LDADD)
+bench_rules_LDADD = $(BENCH_LDADD)
+bench_rulescomp_LDADD = $(BENCH_LDADD)
+
+##
 # Custom targets
 ##
 
diff --git a/bench/.gitignore b/bench/.gitignore
new file mode 100644
index 0000000..bf688ae
--- /dev/null
+++ b/bench/.gitignore
@@ -0,0 +1,3 @@
+key-proc
+rules
+rulescomp
diff --git a/bench/key-proc.c b/bench/key-proc.c
new file mode 100644
index 0000000..255f033
--- /dev/null
+++ b/bench/key-proc.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright © 2012 Ran Benita <ran234@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include <time.h>
+
+#include "../test/test.h"
+
+#define BENCHMARK_ITERATIONS 20000000
+
+static void
+bench(struct xkb_state *state)
+{
+    int8_t keys[256] = { 0 };
+    xkb_keycode_t keycode;
+    xkb_keysym_t keysym;
+    int i;
+
+    for (i = 0; i < BENCHMARK_ITERATIONS; i++) {
+        keycode = (rand() % (255 - 9)) + 9;
+        if (keys[keycode]) {
+            xkb_state_update_key(state, keycode, XKB_KEY_UP);
+            keys[keycode] = 0;
+            keysym = xkb_state_key_get_one_sym(state, keycode);
+            (void) keysym;
+        } else {
+            xkb_state_update_key(state, keycode, XKB_KEY_DOWN);
+            keys[keycode] = 1;
+        }
+    }
+}
+
+int
+main(void)
+{
+    struct xkb_context *ctx;
+    struct xkb_keymap *keymap;
+    struct xkb_state *state;
+    struct timespec start, stop, elapsed;
+
+    ctx = test_get_context(0);
+    assert(ctx);
+
+    keymap = test_compile_rules(ctx, "evdev", "pc104", "us,ru,il,de",
+                                ",,,neo", "grp:menu_toggle");
+    assert(keymap);
+
+    state = xkb_state_new(keymap);
+    assert(state);
+
+    xkb_context_set_log_level(ctx, XKB_LOG_LEVEL_CRITICAL);
+    xkb_context_set_log_verbosity(ctx, 0);
+
+    srand(time(NULL));
+
+    clock_gettime(CLOCK_MONOTONIC, &start);
+    bench(state);
+    clock_gettime(CLOCK_MONOTONIC, &stop);
+
+    elapsed.tv_sec = stop.tv_sec - start.tv_sec;
+    elapsed.tv_nsec = stop.tv_nsec - start.tv_nsec;
+    if (elapsed.tv_nsec < 0) {
+        elapsed.tv_nsec += 1000000000;
+        elapsed.tv_sec--;
+    }
+
+    fprintf(stderr, "ran %d iterations in %ld.%09lds\n",
+            BENCHMARK_ITERATIONS, elapsed.tv_sec, elapsed.tv_nsec);
+
+    xkb_state_unref(state);
+    xkb_keymap_unref(keymap);
+    xkb_context_unref(ctx);
+
+    return 0;
+}
diff --git a/bench/rules.c b/bench/rules.c
new file mode 100644
index 0000000..d92ed07
--- /dev/null
+++ b/bench/rules.c
@@ -0,0 +1,71 @@
+/*
+ * Copyright © 2012 Ran Benita <ran234@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <time.h>
+
+#include "../test/test.h"
+#include "xkbcomp-priv.h"
+#include "rules.h"
+
+#define BENCHMARK_ITERATIONS 20000
+
+int
+main(int argc, char *argv[])
+{
+    struct xkb_context *ctx;
+    struct timespec start, stop, elapsed;
+    int i;
+    struct xkb_rule_names rmlvo = {
+        "evdev", "pc105", "us,il", ",", "ctrl:nocaps,grp:menu_toggle",
+    };
+    struct xkb_component_names kccgst;
+
+    ctx = test_get_context(0);
+    assert(ctx);
+
+    xkb_context_set_log_level(ctx, XKB_LOG_LEVEL_CRITICAL);
+    xkb_context_set_log_verbosity(ctx, 0);
+
+    clock_gettime(CLOCK_MONOTONIC, &start);
+    for (i = 0; i < BENCHMARK_ITERATIONS; i++) {
+        assert(xkb_components_from_rules(ctx, &rmlvo, &kccgst));
+        free(kccgst.keycodes);
+        free(kccgst.types);
+        free(kccgst.compat);
+        free(kccgst.symbols);
+    }
+    clock_gettime(CLOCK_MONOTONIC, &stop);
+
+    elapsed.tv_sec = stop.tv_sec - start.tv_sec;
+    elapsed.tv_nsec = stop.tv_nsec - start.tv_nsec;
+    if (elapsed.tv_nsec < 0) {
+        elapsed.tv_nsec += 1000000000;
+        elapsed.tv_sec--;
+    }
+
+    fprintf(stderr, "processed %d rule files in %ld.%09lds\n",
+            BENCHMARK_ITERATIONS, elapsed.tv_sec, elapsed.tv_nsec);
+
+    xkb_context_unref(ctx);
+    return 0;
+}
diff --git a/bench/rulescomp.c b/bench/rulescomp.c
new file mode 100644
index 0000000..16f2bf5
--- /dev/null
+++ b/bench/rulescomp.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright © 2009 Dan Nicholson
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <time.h>
+
+#include "../test/test.h"
+
+#define BENCHMARK_ITERATIONS 2500
+
+int
+main(int argc, char *argv[])
+{
+    struct xkb_context *ctx;
+    struct xkb_keymap *keymap;
+    struct timespec start, stop, elapsed;
+    int i;
+
+    ctx = test_get_context(0);
+    assert(ctx);
+
+    xkb_context_set_log_level(ctx, XKB_LOG_LEVEL_CRITICAL);
+    xkb_context_set_log_verbosity(ctx, 0);
+
+    clock_gettime(CLOCK_MONOTONIC, &start);
+    for (i = 0; i < BENCHMARK_ITERATIONS; i++) {
+        keymap = test_compile_rules(ctx, "evdev", "evdev", "us", "", "");
+        assert(keymap);
+        xkb_keymap_unref(keymap);
+    }
+    clock_gettime(CLOCK_MONOTONIC, &stop);
+
+    elapsed.tv_sec = stop.tv_sec - start.tv_sec;
+    elapsed.tv_nsec = stop.tv_nsec - start.tv_nsec;
+    if (elapsed.tv_nsec < 0) {
+        elapsed.tv_nsec += 1000000000;
+        elapsed.tv_sec--;
+    }
+
+    fprintf(stderr, "compiled %d keymaps in %ld.%09lds\n",
+            BENCHMARK_ITERATIONS, elapsed.tv_sec, elapsed.tv_nsec);
+
+    xkb_context_unref(ctx);
+    return 0;
+}
diff --git a/test/.gitignore b/test/.gitignore
index 0c2354a..1e2dfb8 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -13,7 +13,6 @@ log
 interactive-evdev
 rmlvo-to-kccgst
 print-compiled-keymap
-bench-key-proc
 atom
 x11
 interactive-x11
diff --git a/test/bench-key-proc.c b/test/bench-key-proc.c
deleted file mode 100644
index e345092..0000000
--- a/test/bench-key-proc.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright © 2012 Ran Benita <ran234@gmail.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdlib.h>
-#include <time.h>
-
-#include "test.h"
-
-#define BENCHMARK_ITERATIONS 20000000
-
-static void
-bench(struct xkb_state *state)
-{
-    int8_t keys[256] = { 0 };
-    xkb_keycode_t keycode;
-    xkb_keysym_t keysym;
-    int i;
-
-    for (i = 0; i < BENCHMARK_ITERATIONS; i++) {
-        keycode = (rand() % (255 - 9)) + 9;
-        if (keys[keycode]) {
-            xkb_state_update_key(state, keycode, XKB_KEY_UP);
-            keys[keycode] = 0;
-            keysym = xkb_state_key_get_one_sym(state, keycode);
-            (void) keysym;
-        } else {
-            xkb_state_update_key(state, keycode, XKB_KEY_DOWN);
-            keys[keycode] = 1;
-        }
-    }
-}
-
-int
-main(void)
-{
-    struct xkb_context *ctx;
-    struct xkb_keymap *keymap;
-    struct xkb_state *state;
-    struct timespec start, stop, elapsed;
-
-    ctx = test_get_context(0);
-    assert(ctx);
-
-    keymap = test_compile_rules(ctx, "evdev", "pc104", "us,ru,il,de",
-                                ",,,neo", "grp:menu_toggle");
-    assert(keymap);
-
-    state = xkb_state_new(keymap);
-    assert(state);
-
-    xkb_context_set_log_level(ctx, XKB_LOG_LEVEL_CRITICAL);
-    xkb_context_set_log_verbosity(ctx, 0);
-
-    srand(time(NULL));
-
-    clock_gettime(CLOCK_MONOTONIC, &start);
-    bench(state);
-    clock_gettime(CLOCK_MONOTONIC, &stop);
-
-    elapsed.tv_sec = stop.tv_sec - start.tv_sec;
-    elapsed.tv_nsec = stop.tv_nsec - start.tv_nsec;
-    if (elapsed.tv_nsec < 0) {
-        elapsed.tv_nsec += 1000000000;
-        elapsed.tv_sec--;
-    }
-
-    fprintf(stderr, "ran %d iterations in %ld.%09lds\n",
-            BENCHMARK_ITERATIONS, elapsed.tv_sec, elapsed.tv_nsec);
-
-    xkb_state_unref(state);
-    xkb_keymap_unref(keymap);
-    xkb_context_unref(ctx);
-
-    return 0;
-}
diff --git a/test/rules-file.c b/test/rules-file.c
index da14e3a..e91d546 100644
--- a/test/rules-file.c
+++ b/test/rules-file.c
@@ -21,14 +21,10 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#include <time.h>
-
 #include "test.h"
 #include "xkbcomp-priv.h"
 #include "rules.h"
 
-#define BENCHMARK_ITERATIONS 20000
-
 struct test_data {
     /* Rules file */
     const char *rules;
@@ -88,45 +84,6 @@ test_rules(struct xkb_context *ctx, struct test_data *data)
     return passed;
 }
 
-static void
-benchmark(struct xkb_context *ctx)
-{
-    struct timespec start, stop, elapsed;
-    enum xkb_log_level old_level = xkb_context_get_log_level(ctx);
-    int old_verb = xkb_context_get_log_verbosity(ctx);
-    int i;
-    struct xkb_rule_names rmlvo = {
-        "evdev", "pc105", "us,il", ",", "ctrl:nocaps,grp:menu_toggle",
-    };
-    struct xkb_component_names kccgst;
-
-    xkb_context_set_log_level(ctx, XKB_LOG_LEVEL_CRITICAL);
-    xkb_context_set_log_verbosity(ctx, 0);
-
-    clock_gettime(CLOCK_MONOTONIC, &start);
-    for (i = 0; i < BENCHMARK_ITERATIONS; i++) {
-        assert(xkb_components_from_rules(ctx, &rmlvo, &kccgst));
-        free(kccgst.keycodes);
-        free(kccgst.types);
-        free(kccgst.compat);
-        free(kccgst.symbols);
-    }
-    clock_gettime(CLOCK_MONOTONIC, &stop);
-
-    xkb_context_set_log_level(ctx, old_level);
-    xkb_context_set_log_verbosity(ctx, old_verb);
-
-    elapsed.tv_sec = stop.tv_sec - start.tv_sec;
-    elapsed.tv_nsec = stop.tv_nsec - start.tv_nsec;
-    if (elapsed.tv_nsec < 0) {
-        elapsed.tv_nsec += 1000000000;
-        elapsed.tv_sec--;
-    }
-
-    fprintf(stderr, "processed %d times in %ld.%09lds\n",
-            BENCHMARK_ITERATIONS, elapsed.tv_sec, elapsed.tv_nsec);
-}
-
 int
 main(int argc, char *argv[])
 {
@@ -135,11 +92,6 @@ main(int argc, char *argv[])
     ctx = test_get_context(0);
     assert(ctx);
 
-    if (argc > 1 && streq(argv[1], "bench")) {
-        benchmark(ctx);
-        return 0;
-    }
-
     struct test_data test1 = {
         .rules = "simple",
 
diff --git a/test/rulescomp.c b/test/rulescomp.c
index 654b275..67ffcb8 100644
--- a/test/rulescomp.c
+++ b/test/rulescomp.c
@@ -21,13 +21,9 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#include <time.h>
-
 #include "evdev-scancodes.h"
 #include "test.h"
 
-#define BENCHMARK_ITERATIONS 2500
-
 static int
 test_rmlvo_va(struct xkb_context *context, const char *rules,
               const char *model, const char *layout,
@@ -68,21 +64,6 @@ test_rmlvo(struct xkb_context *context, const char *rules,
 }
 
 static int
-test_rmlvo_silent(struct xkb_context *context, const char *rules,
-                  const char *model, const char *layout,
-                  const char *variant, const char *options)
-{
-    struct xkb_keymap *keymap;
-
-    keymap = test_compile_rules(context, rules, model, layout, variant,
-                                options);
-    if (keymap)
-        xkb_keymap_unref(keymap);
-
-    return keymap != NULL;
-}
-
-static int
 test_rmlvo_env(struct xkb_context *ctx, const char *rules, const char *model,
                const char *layout, const char *variant, const char *options,
                ...)
@@ -124,36 +105,6 @@ test_rmlvo_env(struct xkb_context *ctx, const char *rules, const char *model,
     return ret;
 }
 
-static void
-benchmark(struct xkb_context *context)
-{
-    struct timespec start, stop, elapsed;
-    enum xkb_log_level old_level = xkb_context_get_log_level(context);
-    int old_verb = xkb_context_get_log_verbosity(context);
-    int i;
-
-    xkb_context_set_log_level(context, XKB_LOG_LEVEL_CRITICAL);
-    xkb_context_set_log_verbosity(context, 0);
-
-    clock_gettime(CLOCK_MONOTONIC, &start);
-    for (i = 0; i < BENCHMARK_ITERATIONS; i++)
-        assert(test_rmlvo_silent(context, "evdev", "evdev", "us", "", ""));
-    clock_gettime(CLOCK_MONOTONIC, &stop);
-
-    xkb_context_set_log_level(context, old_level);
-    xkb_context_set_log_verbosity(context, old_verb);
-
-    elapsed.tv_sec = stop.tv_sec - start.tv_sec;
-    elapsed.tv_nsec = stop.tv_nsec - start.tv_nsec;
-    if (elapsed.tv_nsec < 0) {
-        elapsed.tv_nsec += 1000000000;
-        elapsed.tv_sec--;
-    }
-
-    fprintf(stderr, "compiled %d keymaps in %ld.%09lds\n",
-            BENCHMARK_ITERATIONS, elapsed.tv_sec, elapsed.tv_nsec);
-}
-
 int
 main(int argc, char *argv[])
 {
@@ -161,11 +112,6 @@ main(int argc, char *argv[])
 
     assert(ctx);
 
-    if (argc > 1 && streq(argv[1], "bench")) {
-        benchmark(ctx);
-        return 0;
-    }
-
 #define KS(name) xkb_keysym_from_name(name, 0)
 
     assert(test_rmlvo(ctx, "evdev", "pc105", "us,il,ru,ca", ",,,multix", "grp:alts_toggle,ctrl:nocaps,compose:rwin",
@@ -253,4 +199,5 @@ main(int argc, char *argv[])
     }
 
     xkb_context_unref(ctx);
+    return 0;
 }