Skip to content

Comparison with other demanglers

This page puts demangle beside the demanglers a Python user is most likely to weigh it against: what each one covers, what a run of benchmarks/compare.py measured, and what that measurement can't tell you.

The short version: on names it hasn't seen, the pure-Python code is slower than every native demangler measured here: about 50 times slower than LLVM's on Itanium names and 9 times on MSVC names (both through llvm-demangle-fxti), and about 15 times slower than the Rust cpp_demangle crate on Itanium names. It's level with the one other pure-Python reader, itanium_demangler. What you get instead is fourteen schemes, a parse tree, bounded input, one pure wheel for every platform, and a result cache that makes a repeated name cost under a microsecond.

Measured on 2026-10-25

The run is of main as it stood between 0.6.0 and 0.7.0. Since then 0.8.0 made MSVC names about 1.4 times as fast cold and Swift names about 8% faster, and from 0.9.0 the CPython wheels for Linux, macOS and Windows carry the Itanium parser compiled, which about halves its cold cost. The changelog has the figures. So the cold Itanium, MSVC and Swift rows below are slower than a CPython install is today.

What each one covers

demangle llvm-demangle-fxti cpp-demangle itanium_demangler
Version measured main after 0.6.0, with the Swift and MSVC speed-ups 0.7.0 shipped; it reports 0.6.0 1.0.0 0.1.3 1.1
Written in Python C++: LLVM's Demangle library, vendored; LLVM 11 to 21 selectable Rust: the cpp_demangle crate, through PyO3 Python
Schemes Fourteen: Itanium C++, MSVC, Rust (legacy and v0), Swift, Objective-C, Go, D, Nim, Free Pascal, Delphi, Ada/GNAT, JNI, g++ 2.x with cfront/ARM, Lucid and HP aCC, and CodeWarrior Itanium, Microsoft, Rust v0 and D; a legacy Rust name is read as the Itanium name it also is Itanium Itanium
What comes back A string (demangle), a tree (parse), the parts of a signature (signature) A string; for an Itanium function, ItaniumPartialDemangler answers for its base name, context, parameters and return type A string A tree of nodes, and a string rendering of it
Bounds on hostile input Recursion depth, output size, substitution count and input length, each configurable per call; see SECURITY.md Not tested here Not tested here Not tested here
Distribution A py3-none-any wheel for Python 3.11 or newer, CPython, PyPy and Pyodide; since 0.9.0, compiled cp311 to cp314 wheels for Linux and macOS (x86-64 and arm64) and Windows x86-64 as well cp36-abi3 wheels for Linux x86-64 (glibc and musl), macOS x86-64 and arm64, and Windows 32- and 64-bit, and a source distribution; CPython only cp38-abi3 wheels for Linux x86-64 (glibc), macOS arm64 and Windows x86-64; 0.1.3 lists no source distribution; CPython only One py3-none-any wheel
Latest release on 2026-10-25 0.6.0, 2026-10-11 1.0.0, 2026-02-13, the only release 0.1.3, 2026-04-28; the one before is 2023-05-01 1.1, 2022-08-20

The distribution rows are the file lists on PyPI: llvm-demangle-fxti, cpp-demangle and itanium_demangler. Neither native package lists a PyPy or Pyodide wheel. On a platform with no listed wheel llvm-demangle-fxti has a source distribution to build from, and cpp-demangle 0.1.3 has none.

Three command-line tools were measured as well, each run once over the whole list:

  • GNU c++filt 2.42 reads what its --format option names: gnu-v3 (Itanium), java, gnat, dlang and rust.
  • llvm-cxxfilt 18.1.3 was measured on Itanium names. Given an MSVC name it handed it back unchanged.
  • llvm-undname 18.1.3 reads MSVC names.

Disassemblers carry demanglers of their own. Ghidra 12.1's change history lists a GNU, a Microsoft and a Rust demangler, and IDA 9.4's demangled-names documentation lists Microsoft, Borland, Watcom, Visual Age and GNU. Both lists are from the documentation and neither tool was measured here. The integrations page records what IDA and Ghidra read themselves when the scripts were run in them.

Measured

Run on 2026-10-25 under CPython 3.13.16 on Linux x86-64, on an Intel Xeon at 2.80 GHz with four virtual CPUs. The machine is shared: the one-minute load average read 0.83 when the run began and 1.00 when it ended, and the same workload has run up to half again as fast on it on other days. So read the ratios between rows, not the rates. Each figure is the best of 15 passes.

The report, as the script printed it (Reproducing it has the command):

  • 2026-10-25; CPython 3.13.16; Linux x86_64; Intel(R) Xeon(R) Processor @ 2.80GHz
  • cold: every name distinct, demangle's cache emptied before each pass; best of 15 passes; command-line tools run once over the whole list, starting the process included
  • Read: output differs from input. = X: output identical to X's. ref: X is that row's own tool

itanium-real-world.txt: 318 names, itanium

Tool us/name names/s Read = llvm-cxxfilt = c++filt
demangle 0.6.0 (pure Python) 64.1 15,600 318 318 176
demangle 0.6.0, warm cache 0.69 1,450,000 318 318 176
demangle 0.6.0, style="gnu" 67.0 14,900 318 182 310
llvm-demangle-fxti 1.0.0 (LLVM 21, native) 1.4 697,000 318 318 176
cpp-demangle 0.1.3 (Rust, native) 4.5 220,000 281 163 264
itanium_demangler 1.1 (pure Python) 55.7 18,000 234 108 92
llvm-cxxfilt 18.1.3 (one process) 62.3 16,100 318 ref 176
GNU c++filt 2.42 (one process) 13.1 76,400 310 176 ref

itanium-libstdcxx.txt: 5,886 names, itanium

Tool us/name names/s Read = llvm-cxxfilt = c++filt
demangle 0.6.0 (pure Python) 53.9 18,500 5,886 5,886 2,927
demangle 0.6.0, warm cache 0.73 1,380,000 5,886 5,886 2,927
demangle 0.6.0, style="gnu" 57.6 17,400 5,886 2,927 5,886
llvm-demangle-fxti 1.0.0 (LLVM 21, native) 0.96 1,040,000 5,886 5,886 2,927
cpp-demangle 0.1.3 (Rust, native) 3.5 282,000 5,886 3,071 5,195
itanium_demangler 1.1 (pure Python) 58.7 17,000 5,817 2,718 1,460
llvm-cxxfilt 18.1.3 (one process) 6.9 146,000 5,886 ref 2,927
GNU c++filt 2.42 (one process) 3.6 275,000 5,886 2,927 ref

msvc-boost.txt: 5,843 names, msvc

Tool us/name names/s Read = llvm-demangle-fxti = llvm-undname
demangle 0.6.0 (pure Python) 100.9 9,910 5,843 5,843 5,843
demangle 0.6.0, warm cache 0.90 1,110,000 5,843 5,843 5,843
llvm-demangle-fxti 1.0.0 (LLVM 21, native) 10.7 93,400 5,843 ref 5,843
llvm-undname 18.1.3 (one process) 33.4 29,900 5,843 5,843 ref

rust-real-world.txt: 5,316 names, rust

Tool us/name names/s Read = corpus
demangle 0.6.0 (pure Python) 48.8 20,500 5,316 5,316
demangle 0.6.0, warm cache 0.70 1,420,000 5,316 5,316
llvm-demangle-fxti 1.0.0 (LLVM 21, native) 1.2 803,000 5,308 2,265
llvm-demangle-fxti 1.0.0 (LLVM 21, native), rust_demangle() v0 only 0.94 1,060,000 2,306 2,265

swift-real-world.txt: 8,494 names, swift

Tool us/name names/s Read = corpus
demangle 0.6.0 (pure Python) 88.0 11,400 8,494 8,494
demangle 0.6.0, warm cache 0.73 1,380,000 8,494 8,494

nm -D libstdc++.so.6.0.33: 5,963 names, itanium

Tool us/name names/s Read = llvm-cxxfilt = c++filt
demangle 0.6.0 (pure Python) 56.4 17,700 5,963 5,885 2,986
demangle 0.6.0, warm cache 0.65 1,530,000 5,963 5,885 2,986
demangle 0.6.0, style="gnu" 56.2 17,800 5,963 2,926 5,963
llvm-demangle-fxti 1.0.0 (LLVM 21, native) 1.00 1,000,000 5,888 5,960 2,929
cpp-demangle 0.1.3 (Rust, native) 3.5 289,000 5,963 3,070 5,272
itanium_demangler 1.1 (pure Python) 57.7 17,300 5,885 2,726 1,459
llvm-cxxfilt 18.1.3 (one process) 8.1 123,000 5,885 ref 2,926
GNU c++filt 2.42 (one process) 3.6 275,000 5,963 2,926 ref

How to read the tables:

  • us/name is the cold cost: every name distinct, and demangle's result cache emptied before each pass, so it is the parse and not a lookup. The other in-process tools keep no cache. The warm cache row is the same names again with the cache full.
  • Read is the number of names whose output differs from the input, because a demangler hands back what it can't read. It doesn't say the spelling is right.
  • = X is the number of names whose output is identical, byte for byte, to X's. A tool that declines a name agrees with a reference that declines it. Where no tool is a reference for the scheme, = corpus is the spelling recorded in the corpus file, from the reference its header names: the rustc-demangle crate for Rust, swift-demangle built from the Swift compiler's main for Swift.
  • A command-line row runs the tool once over the whole list, so it includes starting the process and piping the names in and out.
  • The Itanium rows are scored against both llvm-cxxfilt and GNU c++filt, because the two spell some things differently; see the caveats.
  • llvm-demangle-fxti appears twice on the Rust corpus: through demangle(), which picks the scheme from the name, and through rust_demangle(), its v0 reader alone.

Where demangle is slower

Cold, on names it hasn't seen, demangle costs more per name than every native tool measured. Each figure below is its cold us/name divided by the other tool's:

Names llvm-demangle-fxti cpp-demangle itanium_demangler
Itanium, the libstdc++ exports (--nm) 56x 16x 1.0x
Itanium, itanium-libstdcxx.txt 56x 15x 0.9x
Itanium, itanium-real-world.txt 46x 14x 1.2x
MSVC, msvc-boost.txt 9.4x
Rust, rust-real-world.txt 41x; 52x against rust_demangle() alone

That's the cost of reading names in Python instead of compiled code. Against the one other pure-Python reader it's level, on Itanium names only.

The command-line tools were run once over the whole list, so their figures include starting the process. Over the libstdc++ exports GNU c++filt reads 16 times as many names a second as demangle does cold, and llvm-cxxfilt 7.0 times; over the MSVC names llvm-undname reads 3.0 times as many. On the 318-name corpus process start dominates instead: llvm-cxxfilt takes about 20 ms in all, 62.3 us a name against demangle's 64.1.

As a job: at the rates for the libstdc++ exports, 100,000 distinct names take demangle about 5.6 s and llvm-demangle-fxti about 0.10 s.

What narrows the gap in practice is repetition. A symbol table repeats its names, and a name read a second time costs 0.65 to 0.9 us here, a dictionary lookup. That's the cache and not the parser, and you could put a cache in front of any of the other tools too. That wasn't measured.

Where it leads

  • Breadth. demangle reads fourteen schemes. Of the libraries compared, only it reads Swift, Objective-C, Go, Nim, Free Pascal, Delphi, Ada/GNAT, JNI and the pre-Itanium C++ styles. (GNU c++filt has a GNAT style as well, and isn't a library.) A separate loop over the checked-in corpora, which compare.py doesn't run, found llvmdemangle.demangle() changing none of the names in the Swift, Go, Nim, Objective-C, Free Pascal, Delphi, Ada, JNI, g++ 2.x and CodeWarrior corpora, and 256 of the 1,257 in the D one.
  • Rust, where the schemes overlap. The readings still differ. In the Rust corpus 3,002 of the 5,316 names are legacy _ZN...E names and 2,314 are v0. llvm-demangle-fxti reads a legacy name as the Itanium name it also is, so the $LT$ escapes and the ::h<hash> stay in the output, and none of the 3,002 comes back as rustc-demangle spells it. Its Rust reader takes 2,306 of the 2,314 v0 names and spells 2,265 of them as rustc-demangle does. demangle matches rustc-demangle on all 5,316.
  • Conformance. Scored against llvm-cxxfilt, demangle agrees on all 5,886 names of itanium-libstdcxx.txt and on 5,885 of the 5,963 the libstdc++ here exports. The other 78 are names that LLVM 18 leaves mangled and GNU c++filt reads: 69 transaction clones (_ZGTt...), six _Float32x-family types and three std::bfloat16_t typeinfo names. In GNU style it agrees with c++filt on every name of both sets. On the MSVC names it agrees with llvm-undname and with the LLVM binding on all 5,843. cpp-demangle agrees with llvm-cxxfilt on 3,070 of the libstdc++ names and itanium_demangler on 2,726; the caveats show what sort of difference that is. Conformance is the whole account, over about 2,500,000 live symbols.
  • A tree. parse() returns nodes for all fourteen schemes, signature() the parts of a name, and to_dict() the tree as data. Of the others, itanium_demangler returns a tree for Itanium names, and LLVM's ItaniumPartialDemangler answers for the parts of an Itanium function name. The rest return strings.
  • Bounded input. Recursion depth, output size, substitution count and input length are bounded and configurable per call, a bound ends the reading rather than guessing, and demangle() never raises. SECURITY.md has the threat model and how the bounds are tested. The other tools weren't tried on hostile input here, so this page makes no claim about them.
  • A pure wheel. It serves every platform, CPython and PyPy, and runs in a browser under Pyodide, which is how the playground works. The two native packages publish CPython wheels for the platforms in the first table, and neither lists a PyPy or Pyodide wheel.
  • A cache that comes with it. demangle() keeps a result cache bounded in bytes as well as entries, so a loop over a symbol table needs no wrapper. The warm rows show what it buys. It's a convenience and not a faster parser.

What the numbers do not say

  • Exact-string agreement counts style. llvm-cxxfilt and GNU c++filt themselves agree on only 2,926 of the 5,963 libstdc++ names, most of the difference being spacing, > > against >>. That's why there are two reference columns, and why demangle also appears with style="gnu", which matches c++filt on every one. The differences aren't all spacing. Four names, with what each tool prints where they differ:

    _ZNSt6vectorIiSaIiEE9push_backERKi
      llvm-cxxfilt, LLVM binding, itanium_demangler, demangle:
        std::vector<int, std::allocator<int>>::push_back(int const&)
      c++filt, cpp-demangle, demangle with style="gnu":
        std::vector<int, std::allocator<int> >::push_back(int const&)
    
    _ZNSs6insertEmRKSs
      llvm-cxxfilt, LLVM binding, cpp-demangle, itanium_demangler, demangle:
        std::string::insert(unsigned long, std::string const&)
      c++filt, demangle with style="gnu":
        std::basic_string<char, std::char_traits<char>, std::allocator<char> >::insert(unsigned long, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
    
    _ZTVNSt8ios_base7failureE
      everyone but cpp-demangle:
        vtable for std::ios_base::failure
      cpp-demangle:
        {vtable(std::ios_base::failure)}
    
    _ZNKSt7codecvtIDsc11__mbstate_tE9do_lengthERS0_PKcS4_m
      everyone but itanium_demangler:
        std::codecvt<char16_t, char, __mbstate_t>::do_length(__mbstate_t&, char const*, char const*, unsigned long) const
      itanium_demangler:
        std::codecvt<char16_t, char, __mbstate_t>::do_length const(__mbstate_t&, char const*, char const*, unsigned long)
    

    itanium_demangler also writes constructors as {ctor} and doesn't read _ZTIDF32_, which every other tool reads as typeinfo for _Float32. It spells VK as const volatile or volatile const depending on Python's hash seed, so its = llvm-cxxfilt count on itanium-real-world.txt is 108 in some runs and 109 in others. A mismatch in the tables is a reason to look at the names, not a verdict.

  • The LLVM binding is a different LLVM from the command-line tools. It defaults to LLVM 21; llvm-cxxfilt and llvm-undname here are LLVM 18. llvm-demangle-fxti ships LLVM 11 to 21, and --llvm 18 reads with the release the command-line tools were built from. It then agrees with llvm-cxxfilt on all 5,963 libstdc++ names, where LLVM 21 agrees on 5,960: LLVM 21 reads the three std::bfloat16_t names that 18 leaves mangled. The MSVC and Rust counts don't move. The speeds in the tables are LLVM 21's.

  • The corpora are this project's own conformance corpora. msvc-boost.txt holds only names llvm-undname 18 reads, by its header, and every name of itanium-libstdcxx.txt is read by llvm-cxxfilt, so the references' Read counts there aren't a finding. Another set of names would give other counts, and other speeds: MSVC names cost more to read than Itanium ones in every tool measured.

  • One machine, one Python, one run. CPython 3.13 on a shared virtual machine. PyPy, other CPython versions, memory, import time and threads weren't measured.

  • The author is one of the competitors. The project that publishes demangle wrote the script, the page and the corpora. They are in the repository, and the report prints the versions it measured.

Reproducing it

pip install llvm-demangle-fxti cpp-demangle itanium-demangler
apt-get install llvm binutils        # llvm-cxxfilt, llvm-undname, c++filt, nm
python benchmarks/compare.py --repeats 15 --nm /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.33
python benchmarks/compare.py --llvm 18

None of the other tools is a dependency of demangle or of any of its dependency groups. One that isn't installed is skipped with a note at the top of the report. --llvm N picks one of the LLVM releases llvm-demangle-fxti carries, --limit N uses the first N names of each corpus for a quick look, and --repeats N sets the number of passes.