Skip to content

Caching lambda expressions used to manipulate objects using reflection #6968

@ekolis

Description

@ekolis

Sorry if this is the wrong place to suggest this; I've never tried to contribute to .NET in this way before!

Anyway, in a project of mine I wrote a serializer that relied heavily on reflection, and it was horribly slow. However I was able to speed it up quite a bit by creating, compiling, and caching a lambda expression for each property getter and setter of each class I was serializing. I was thinking something like this could be built into the CLR, to make reflection much faster. I don't know what this does to memory usage, but perhaps at least there could be a static flag to set on some class somewhere, or a core library which does what I was doing in case anyone needs it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Reflectiondesign-discussionOngoing discussion about design without consensusenhancementProduct code improvement that does NOT require public API changes/additionstenet-performancePerformance related issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions