Comments (6)
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.
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.
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.
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.
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.
It's been almost a month and PR is still not implemented. 🤔
from hazel.
Related Issues (20)
- Unable to save a new Scene - "The file name is not valid" HOT 1
- Package Manager like conan 2.0 or 1.0 for 3rd party vendors ?
- Redundant two lines of code to set io.DisplaySize in ImGuiLayer.cpp
- Error on the first compiling of Hazel.sln HOT 1
- Error: cannot open Hazel/vendor/Box2D: No such file or directory HOT 8
- Linking Error when compiling. HOT 4
- in Sandbox: ExampleLayer OnImGuiRender ImGui::Begin("test") trigger an error
- MacOS Support HOT 5
- Error during instalation "name 'solution_items' in use"
- Proper Rigid Body Physics engine
- I have added the transform component UI to my Engine and it's working good but there is a slight problem . HOT 1
- I have added the transform component UI to my Engine and it's working good but there is a slight problem which is the scale on the z axis doesn't work. why is that ? and how to fix it ? HOT 1
- 11 HOT 3
- The m_VulkanSPIRV and m_OpenGLSPIRV variables in OpenGLShader.cpp have no numerical values and remain empty, Why is it still used for assignment?
- Hello Everyone
- Hello Everyone. HOT 1
- Really Need Help ! HOT 1
- ShaderBinary problem HOT 4
- Problem when running Project on Intel GPUs HOT 7
- Transform Component Add Crash HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hazel.