Skip to content

Performance of Cursor's CursorChildren (CXCursor.VisitChildren) #260

@danieljennings

Description

@danieljennings

When profiling our application that uses ClangSharp, I've noticed that the Cursor class's CursorChildren lazy property evaluation takes a significant amount of time on profiles, specifically inside of the CXCursor.VisitChildren call.

It looks like 75% of that time is being spent inside of MarshalNative::GetFunctionPointerForDelegateInternal (of which nearly all of the time is inside of COMDelegate::ConvertToCallback).

Given the fact that this is likely to be a hotspot across many applications, is there an opportunity to avoid such a penalty by avoiding using the more "generic" CXCursor.VisitChildren in lieu of a custom native method that is P/Invoked to populate a List of the immediate children of a given Cursor using a native function (therefore avoiding interop of the otherwise-uninteresting delegate)?

If that's feasible, am I correct in my understanding of the project hierarchy here that such code would live within the libClangSharp project?

Thanks,

Daniel Jennings
Valve

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions