Giter Site home page Giter Site logo

Comments (7)

khuey avatar khuey commented on August 15, 2024 1

I released 0.4.2 with this fixed.

from cpp_demangle.

khuey avatar khuey commented on August 15, 2024

This pathological symbol triggers the default recursion limits in cpp_demangle. The error handling paths are slow (I haven't investigated that) and lead to the 0.5 second runtime you see. If you bump the recursion limits (I haven't attempted to find minimal values here) like so, it will parse correctly in less than a tenth of that time.

if let Ok(sym) = cpp_demangle::BorrowedSymbol::new_with_options(name.as_bytes(),  &ParseOptions::default().recursion_limit(256)) {
    let mut demangled = String::new();
    let options = cpp_demangle::DemangleOptions::default()
        .recursion_limit(256);
    if let Ok(()) = sym.structured_demangle(&mut demangled, &options) {
        dbg!(demangled);
    }
}

from cpp_demangle.

athre0z avatar athre0z commented on August 15, 2024

Thanks for the swift response!

Oh wow, yeah, I can confirm that this speeds things up quite significantly. The error path being slow certainly wasn't on my list of possible reasons here -- I figured it would just bubble up an error and that's it. Interesting.

I actually have to raise the limit to 512 in order to not run into this for all symbols in this executable (also not minimized, but 256 is not enough so I just doubled).

from cpp_demangle.

athre0z avatar athre0z commented on August 15, 2024

Thanks a lot for the swift fix -- works great here! The pathological executable where it used to take more than an hour to demangle all the symbols now parses in 3 seconds.

from cpp_demangle.

khuey avatar khuey commented on August 15, 2024

Was that with the recursion limit at the default?

from cpp_demangle.

athre0z avatar athre0z commented on August 15, 2024

Yes.

from cpp_demangle.

khuey avatar khuey commented on August 15, 2024

Great!

from cpp_demangle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.