Giter Club home page Giter Club logo

Comments (3)

sglienke avatar sglienke commented on June 15, 2024

Tiny.Rtti is undoubtedly faster than System.Rtti but that benchmark is comparing apples and oranges. It tests the rather high level TRttiMethod.Invoke that also uses TValue against the rather low level Tiny.Invoke where you need to mess around with pointers and stuff to do the invoke call.

And it even cheats by putting some of the work Tiny.Rtti has to do for the Invoke call outside of the measured loop!

If you want to make invocations via System.Rtti faster then use the Invoke Routine that avoids all the additional stuff happening in TRttiMethod.Invoke/DispatchInvoke but then you need to take care about all the low level parameter passing mechanisms yourself similar to Tiny.Rtti where you just pass the TRttiInvokeDump record representing registers and stack. That would rather be comparable with the implementation only routine RawInvoke from System.Rtti.

If I test System.Rtti.Invoke(LMethod.CodeAddress, [Self, 1, 2, 3], LMethod.CallingConvention, nil); against a non cheated Tiny.Rtti I get a difference of 5 to 1.

Additional fun fact: in my test using OptimalInvokeFunc was approx 5-10% slower than using UniversalInvokeFunc

from delphi-event-bus.

edwinyzh avatar edwinyzh commented on June 15, 2024

@d-mozulyov, comments by sglienke FYI :)

from delphi-event-bus.

d-mozulyov avatar d-mozulyov commented on June 15, 2024

@edwinyzh,

The key difference is that the number of calculations is minimized, the main calculations occur at the signature analysis stage.

I also draw attention to the fact that Tiny.Rtti is not yet a full-fledged replacement for System.Rtti. Wait for new releases.

from delphi-event-bus.

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.