GithubHelp home page GithubHelp logo

Comments (6)

Chlorie avatar Chlorie commented on August 15, 2024 5

As @ilikenoodles2 benchmarked it, the speed improvement is definitely very small. Only 2.4 microseconds. So this is likely a micro optimization. "Premature optimization is the root of all evil".

But I don't think a 20%+ improvement is "micro optimization", since the event system is used all over the code.
Plus making it a template doesn't cost you anything, and it gives you better performance together with better IDE diagnostics. (Those red lines under your code is way better than matryoshka template substitution error after you hit the compile button.)
I agree that premature optimization is the root of all evil, but what optimization is premature depends on each person's opinion. If you're just spending time trying to do things right in my humble opinion it is not premature.

from hazel.

LovelySanta avatar LovelySanta commented on August 15, 2024 3

In my opinion, an optimalisation must be measured in relative improvement instead of the overal time.

As @WhoseTheNerd said, 2.4us optimalisation might not sound alot, but on an operation that only took 11.9us to begin with, this is an optimalisation that is >20% as @Chlorie said.

I can totaly understand that for example #76 is a premature optimalisation, but this has a great impact for the functionality it provides:

  • It is >20% faster to distribute events (keep in mind it will do this for each layer, for each event)
  • Feature: passing wrong functor will cause compilor error

If it was up to me, I would suggest approve starting a PR to implement this...

from hazel.

ilikenoodles2 avatar ilikenoodles2 commented on August 15, 2024 2

I'd like to note that when timing Application's OnEvent, I get an average time of 0.0119ms, whereas when templating the function, the average time is 0.0095ms. Definitely an improvement.

Edit: To clarify, this was with only one call to Dispatch

from hazel.

CleverSource avatar CleverSource commented on August 15, 2024 1

No one has even made a PR for this. OP should consider making a PR for this or someone else could, I'd be up for it though.

from hazel.

WhoseTheNerd avatar WhoseTheNerd commented on August 15, 2024

As @ilikenoodles2 benchmarked it, the speed improvement is definitely very small. Only 2.4 microseconds. So this is likely a micro optimization. "Premature optimization is the root of all evil".

from hazel.

WhoseTheNerd avatar WhoseTheNerd commented on August 15, 2024

It's been almost a month and PR is still not implemented. 🤔

from hazel.

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.