cpython/Tools/c-analyzer/cpython
Victor Stinner 0518edc170
gh-119396: Optimize unicode_repr() (#119617)
Use stringlib to specialize unicode_repr() for each string kind
(UCS1, UCS2, UCS4).

Benchmark:

+-------------------------------------+---------+----------------------+
| Benchmark                           | ref     | change2              |
+=====================================+=========+======================+
| repr('abc')                         | 100 ns  | 103 ns: 1.02x slower |
+-------------------------------------+---------+----------------------+
| repr('a' * 100)                     | 369 ns  | 369 ns: 1.00x slower |
+-------------------------------------+---------+----------------------+
| repr(('a' + squote) * 100)          | 1.21 us | 946 ns: 1.27x faster |
+-------------------------------------+---------+----------------------+
| repr(('a' + nl) * 100)              | 1.23 us | 907 ns: 1.36x faster |
+-------------------------------------+---------+----------------------+
| repr(dquote + ('a' + squote) * 100) | 1.08 us | 858 ns: 1.25x faster |
+-------------------------------------+---------+----------------------+
| Geometric mean                      | (ref)   | 1.16x faster         |
+-------------------------------------+---------+----------------------+
2024-05-28 18:05:20 +02:00
..
__init__.py bpo-36876: Fix the C analyzer tool. (GH-22841) 2020-10-22 18:42:51 -06:00
__main__.py gh-102033: Fix syntax error in Tools/c-analyzer (GH-102066) 2023-03-22 07:59:32 -07:00
_analyzer.py gh-105407: Remove unused imports in Tools/c-analyzer/ (#105410) 2023-06-06 21:08:48 +00:00
_builtin_types.py gh-94673: [c-analyzer] Add a Script to Identify Static Types (#94989) 2022-07-18 19:03:57 -06:00
_capi.py gh-102033: Fix syntax error in Tools/c-analyzer (GH-102066) 2023-03-22 07:59:32 -07:00
_files.py gh-90815: Add mimalloc memory allocator (#109914) 2023-10-30 15:43:11 +00:00
_parser.py gh-119396: Optimize unicode_repr() (#119617) 2024-05-28 18:05:20 +02:00
globals-to-fix.tsv gh-117398: Statically Allocate the Datetime C-API (GH-119472) 2024-05-23 21:15:52 +02:00
ignored.tsv gh-117142: ctypes: Clean up c-analyzer .tsv files (GH-117544) 2024-05-22 20:30:41 +00:00
known.tsv bpo-36876: Fix the C analyzer tool. (GH-22841) 2020-10-22 18:42:51 -06:00