GithubHelp home page GithubHelp logo

Comments (4)

AustinBrunkhorst avatar AustinBrunkhorst commented on May 17, 2024

Yes, those three points are for the most part, a good overview of what the code is intended to do.

Can this project to be used as a code generator?

Yes! that's precisely what this project aims to do. I'm not entirely sure if this answers your questions, but feel free to let me know if you want elaboration on any aspect of the project.

from cpp-reflection.

Jayatubi avatar Jayatubi commented on May 17, 2024

@AustinBrunkhorst Thanks for your answer. I just tried the clang python binding, I think that uses the same libclang runtime as your project, and I found the parsing is a bit slow even with precompiled header.

I have lots of code contain my customized meta data, via __attribute__((annotate)), to be parsed and the processing speed is totally not acceptable. It expands the compile time about 1.5 times longer because each file will be compile/parse twice.

Do you have any idea about to speed up the parsing? May it ignore certain #includes such as the STL library?

from cpp-reflection.

AustinBrunkhorst avatar AustinBrunkhorst commented on May 17, 2024

Running a parser setup like in Source/Parser should be pretty quick.

The parser setup in this repository actually only uses Clang to build the abstract syntax tree (AST) from the headers that your provide. It does not compile it. This means that if your code fails to compile in your regular compiler, the parser in most cases will still be able to correctly build the syntax tree (I've tried it).

I'm confused with what stage of the pipeline it is that you are suggesting is slow.

I found the parsing is a bit slow even with precompiled header.

When I read this, I see you referencing two different steps in the build pipeline. Parsing is the step where you input a header file for your project along with the the appropriate include directories and hand it off to clang to build the AST and spit out your desired code based off what you know about your code base.

The precompiled header is only relevant when actually compiling your code with your normal compiler (not libclang, used for parsing). If you mean including the precompiled header in the header file you pass to the parser, this can definitely affect performance negatively, but depending on the size of your project it shouldn't be too drastic.

Having used this setup for the last few months in a larger project, I can confirm that the bottleneck in the pipeline is actually linking the generated code with the regular code base. This is simply because the current setup generates a lot of lambda functions which in turn bloats translation units for the project. I plan on revising the pipeline over the next few months to address final compile/link times, so I'll definitely keep this repository up to date during these changes.

Another suggestion to improve performance is to ensure that you are building the parser in a release configuration.

I hope this answers your questions.

from cpp-reflection.

Jayatubi avatar Jayatubi commented on May 17, 2024

Thanks for the answer. I will try your solution.

from cpp-reflection.

Related Issues (15)

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.