Giter Club home page Giter Club logo

Comments (3)

jbruening avatar jbruening commented on July 22, 2024

Yes, it uses reflection. To reduce it, propertyinfos are cached on awake for DataContext and INPCBinding, and there is some additional processing relegated to editor build-time for the CommandBinding. Most of the real cost comes from the use of GetValue and SetValue when properties are changed.

Again, though, this is only when the properties are changed, which also only happens if the classes with those properties implement INotifyPropertyChanged. If they don't, then the properties are only gotten once. SetValue happens whenever the interface changes need to be applied back to the viewmodel.

While slow compared to direct access, it is plenty fast(1200 nano seconds for a getvalue) for a standard user interface, as people are slow when it comes to typing, clicking buttons, etc - things that happen less than once per frame. Do not use it to do something like binding to an object's position that is updated every frame.

You can also see for yourself by running one of the example scenes that the framerate is basically unaffected by the use of the inpcbinding components.

As a last remark: Unity themselves use reflection for the UnityEvents, in the form of invoking delegates.

from ugui-mvvm.

jbruening avatar jbruening commented on July 22, 2024

commit e63bd8d now also addresses this via giving you the option of generating property accessor functions.

from ugui-mvvm.

MEyes avatar MEyes commented on July 22, 2024

cool

from ugui-mvvm.

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.