bench


Log

Author Commit Date CI Message
Pierre Le Marre 8e92f25e 2025-03-13T21:26:59 rules: Added xkb_components_names_from_rules() This is mainly for debugging purposes and to enable displaying KcCGST values from RMLVO resolution in `xkbcli compile-keymap --kccgst`.
Pierre Le Marre e1892266 2025-02-13T16:57:46 clang-tidy: Miscellaneous fixes
Ran Benita df2322d7 2025-02-05T14:41:21 Replace include guards by `#pragma once` We currently have a mix of include headers, pragma once and some missing. pragma once is not standard but is widely supported, and we already use it with no issues, so I'd say it's not a problem. Let's convert all headers to pragma once to avoid the annoying include guards. The public headers are *not* converted. Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita e120807b 2025-01-29T15:35:22 Update license notices to SDPX short identifiers + update LICENSE Fix #628. Signed-off-by: Ran Benita <ran@unusedvar.com>
Pierre Le Marre 0c940827 2025-01-22T16:39:35 clang-tidy: Macro arguments should be enclosed in parentheses
Pierre Le Marre 842497d9 2025-01-22T16:46:11 clang-tidy: Fix implicit or incorrect integer casts
Pierre Le Marre b76617e6 2025-01-22T16:42:47 clang-tidy: Various fixes related to IO
Pierre Le Marre 4b0209df 2025-01-21T07:26:33 bench: Fix embedded directive within macro arguments Embedding a directive within macro arguments has undefined behavior.
Pierre Le Marre ddb731ce 2025-01-20T18:01:08 bench: Add xkb_keymap_get_as_string Based on the `compile-keymap` benchmark.
Pierre Le Marre 7c4c718b 2024-09-30T06:13:38 Allow only the first group in symbols sections when using RMLVO Currently `xkb_keymap_num_layouts` may return a greater number than the number of layouts configured using RMLVO, because we allow symbols sections to define various groups per key. This is unintuitive and kind of buggy: groups should be added via rules by setting an explicit `:n` modifier. Fix: when parsing a keymap using RMLVO resolution: - Get the expected layouts count from the resulting KcCGST. - Drop the groups after the first one in included symbols sections. This will ensure that a symbol section can only define one group per key. Notes: - Compiling a keymap string directly is unaffected. - RMLVO resolution may still produce more groups than the input layouts. Indeed, some legacy rules in xkeyboard-config rely on this to insert automatically a US layout before the given non-Latin one, resulting in two layouts while only one was given.
Pierre Le Marre f6f30c6b 2023-09-25T12:07:58 Add benchark for compile-keymap Implement `tasty-bench` method: 1. Set n = 1. 2. Measure execution time t_n of n iterations and execution time t_2n of 2n iterations. 3. Find t which minimizes deviation of (n·t, 2·n·t) from (t_n, t_2n), namely t = (t_n + 2·t_2n)/5n. 4. If deviation is small enough (see --stdev CLI parameter), return t as a mean execution time. 5. Otherwise set n = 2·n and jump back to Step 2. See: https://hackage.haskell.org/package/tasty-bench
Pierre Le Marre 8bc426e2 2024-07-30T14:45:35 compose: Add optional foreach traversal to benchmark This allow us to compare the iterator API to the fastest implementation, `foreach`.
Pierre Le Marre e83d08dd 2024-02-23T17:10:15 keysyms: Fast and complete case mappings (Unicode 15.1) The current code to handle keysym case mappings is quite complex and slow. It is also incomplete, as it does not cover recent Unicode database. Finally, it does not handle title case correctly. It would be easier if we were to use only a lookup table, but a trivial implementation would lead to a huge array: the cased characters range from `U+0041` to `U+`1F189, i.e. a span of 127 304 elements. Thus we need some tricks to compress the lookup table. We based our work on the post: https://github.com/apankrat/notes/blob/3c551cb028595fd34046c5761fd12d1692576003/fast-case-conversion/README.md The compression algorithm is roughly: 1. Compute the delta between the characters and their mappings. 2. Split the delta array in chunk of a given size. 3. Rearrange the order of the chunks in order to optimize consecutive chunks overlap. 4. Create a data table with the reordered chunks and an index table that maps the original chunk index to its offset in the data table. The compression algorithm is then applied a second time to the previous index table. The complete algorithm optimizes the two chunk sizes in order to get the lowest total data size. The mappings were generated using CPython 3.12.4, PyICU 2.13, PyYaml 6.0.1 and ICU 75.1. Also: - Added explicit list of named keysyms and their case mappings. - Added benchmark for case mappings. - Rework ICU tests. Note: 13b30f4f0dccc08dfea426d73570b913596ed602 introduced a fix for sharp S `U+00DF`. With the new implementation, the *conversion* functions `xkb_keysym_to_{lower,upper}` leave it *unchanged*, while the *predicate* functions `xkb_keysym_is_{lower,upper_or_title}` produce the expected results: ```c xkb_keysym_to_upper(XKB_KEY_ssharp) == XKB_KEY_ssharp; xkb_keysym_to_lower(XKB_KEY_ssharp) == XKB_KEY_ssharp; xkb_keysym_to_lower(XKB_KEY_Ssharp) == XKB_KEY_ssharp; xkb_keysym_is_lower (XKB_KEY_ssharp) == true; xkb_keysym_is_upper_or_title(XKB_KEY_Ssharp) == true; ```
Pierre Le Marre 45d64a7c 2024-02-23T17:10:14 keysyms: Add benchmark for case mapping functions
Ran Benita a1770132 2023-09-25T11:41:48 Compose: add iterator API Allow users to iterate the entries in a compose table. This is useful for other projects which want programmable access to the sequences, without having to write their own parser. - New API: - `xkb_compose_table_entry_sequence`; - `xkb_compose_table_entry_keysym`; - `xkb_compose_table_entry_utf8`; - `xkb_compose_table_iterator_new`; - `xkb_compose_table_iterator_free`; - `xkb_compose_table_iterator_next`. - Add tests in `test/compose.c`. - Add benchmark for compose traversal. - `tools/compose.c`: - Print entries instead of just validating them. - Add `--file` option. - TODO: make this tool part of the xkbcli commands. Co-authored-by: Pierre Le Marre <dev@wismill.eu> Co-authored-by: Ran Benita <ran@unusedvar.com> Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita bd79a960 2023-04-11T23:24:47 Possible fix for non-MSVC windows compilers `_MSC_VER` is specific to MSVC, but there can be other compilers targeting windows. Hopefully they do define `_WIN32`, so let's use that. Refs: https://github.com/xkbcommon/libxkbcommon/issues/305 Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita eb59a1c5 2021-06-10T17:13:57 bench/compose: fix compose file path Forgotten in e2465c2. Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 09ac27f7 2021-05-22T19:51:02 ignore: remove no longer relevant gitignore files These were relevant for the autoconf build but now we're meson only. Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita baf55226 2021-04-08T10:51:07 bench: add atom benchmark Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 5f8c2fa4 2021-04-27T12:31:37 bench/rulescomp: decrease benchmark iterations No need for more, and easier to convert to milliseconds per iteration. Signed-off-by: Ran Benita <ran@unusedvar.com>
Peter Hutterer 7a205e25 2021-03-18T11:08:16 bench: silence coverity complaint about a double free False positive because we rely on xkb_components_from_rules() to initalize this struct, but let's localize the variable anyway to shut coverity up. libxkbcommon-1.0.3/bench/rules.c:59:9: warning[-Wanalyzer-double-free]: double-free of kccgst.symbols Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Ran Benita 1bd3b3c7 2020-11-19T00:28:37 x11: cache X11 atoms On every keymap notify event, the keymap should be refreshed, which fetches the required X11 atoms. A big keymap might have a few hundred of atoms. A profile by a user has shown this *might* be slow when some intensive amount of keymap activity is occurring. It might also be slow on a remote X server. While I'm not really sure this is the actual bottleneck, caching the atoms is easy enough and only needs a couple kb of memory, so do that. On the added bench-x11: Before: retrieved 2500 keymaps from X in 11.233237s After : retrieved 2500 keymaps from X in 1.592339s Signed-off-by: Ran Benita <ran@unusedvar.com>
Adrian Perez de Castro 9e3045c7 2019-08-05T16:57:45 MSVC: Provide an implementation of gettimeofday()
Ran Benita d1e39c11 2019-12-28T14:11:27 test/atom: use correct format specifier for size_t From MSVC: test\atom.c(98): note: consider using '%zu' in the format string test\atom.c(98): warning C4477: 'fprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 1 has type 'size_t' test\atom.c(100): note: consider using '%zu' in the format string test\atom.c(100): warning C4477: 'fprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 1 has type 'size_t' test\atom.c(114): note: consider using '%zu' in the format string test\atom.c(114): warning C4477: 'fprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 1 has type 'size_t' test\atom.c(128): note: consider using '%zu' in the format string test\atom.c(128): warning C4477: 'fprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 1 has type 'size_t' test\atom.c(130): note: consider using '%zu' in the format string test\atom.c(130): warning C4477: 'fprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 1 has type 'size_t' test\atom.c(137): note: consider using '%zu' in the format string test\atom.c(137): warning C4477: 'fprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 2 has type 'size_t' Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita da4a90c1 2019-12-28T13:49:40 Open files in binary mode This turns off some misfeatures on Windows, and does nothing on POSIX. Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 40aab05e 2019-12-27T13:03:20 build: include config.h manually Previously we included it with an `-include` compiler directive. But that's not portable. And it's better to be explicit anyway. Every .c file should have `include "config.h"` first thing. Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita c8e17eed 2018-07-05T18:13:14 bench: simplify the bench helpers Trim the API a bit. Also, just always use gettimeofday(), which is portable. Hopefully the system clock doesn't change while a benchmark is running. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita d44ba481 2017-07-29T22:43:08 build: remove unneeded preprocessor include flags Better to avoid these unexpected include paths. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita fe81dcbd 2016-09-19T10:09:12 bench: fix compilation on hurd Patch by Samuel Thibault. https://github.com/xkbcommon/libxkbcommon/issues/39 Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 853b7502 2016-09-16T09:36:27 bench/compose: tabs -> spaces Signed-off-by: Ran Benita <ran234@gmail.com>
Bryce Harrington ea9a5bcf 2016-09-15T14:12:38 bench: Check for errors opening Compose file Otherwise it can segfault e.g. running ./compose inside the bench directory. Signed-off-by: Bryce Harrington <bryce@bryceharrington.org> Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 4c24f7fa 2016-03-15T20:42:21 test: assert/ignore some warn_unused_result's Signed-off-by: Ran Benita <ran234@gmail.com>
Kazunobu Kuriyama 3c12d671 2015-08-24T13:33:32 bench: Modify benchmarks for a wider range of platforms - Add the new files bench.c and bench.h to implement a timer module. - Implement the module with clock_gettime(), mach_absolute_time(), or gettimeofday(), depending on a given platform. - Replace the time measurement code of the benchmark programs with the functions of the module.
Ran Benita 8d58e250 2014-10-03T00:30:43 bench/compose: add new benchmark Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita bc3b4c08 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>