Skip to content

v0.8.0

Choose a tag to compare

@github-actions github-actions released this 13 Nov 20:27
Immutable release. Only release title and notes can be modified.
58041a3

Changed

  • LimitExceeded is no longer a ParseError. It derives from DemanglingError
    directly, so except ParseError stops taking "too large to read under these limits"
    for "malformed". Code that caught ParseError to cover both should catch
    DemanglingError. It has no position any more; it never had one to give.
  • demangle_all() refuses a single name. A str is an iterable of str, so
    demangle_all("_Z1fv") came back as ['_', 'Z', '1', 'f', 'v']. One str or bytes
    object is a TypeError now.
  • demangle_text() and find_symbols() say what was wrong with a text that is not
    a str.
    It was a TypeError out of re, and find_symbols() raised it at the
    first next() rather than at the call.

Added

  • Node.find() takes a node class as well as a kind string: tree.find(Name)
    yields Name nodes, subclasses included, and a type checker then knows their fields.
  • CacheStats, the TypedDict that cache_stats() returns, in place of
    dict[str, Any].
  • Annotations on the rest of the core: the node constructors, Reader, the registry
    and the fields of LanguagePlugin and Style, so a scheme written against them is
    type-checked. DemanglingError declares the mangled every subclass sets.

Performance

  • MSVC names read about 1.4x faster cold over a symbol table (msvc-boost.txt: 64 to
    46 us a name). The template instantiations a name spells out are remembered across
    names now, not just within one, so a table that writes out the same
    std::basic_string<...> thousands of times reads it once. The memo is bounded at
    about 8M characters and cache_clear() empties it. Output is unchanged.
  • Swift names read about 8% faster cold (swift-real-world.txt: 53 to 49 us a name, 17%
    fewer instructions). Identifiers are split into words by a regular expression rather
    than a loop over characters, and the commonest productions, nominal types, tuples and
    function types, pop the stack directly instead of through helpers. Output is
    unchanged.

Install with python -m pip install --upgrade demangle.

See the changelog for details.