-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect block tick measurement #11
Comments
Are you sure about this? As far as I understand, expressions in function parameters are eagerly evaluated before the function is actually called, and the bytecode seems to reflect that: However, you are right, it does seem that there are a few extra instructions being evaluated in there, so I'll try to optimize it further (e.g. getting a reference to the profiler instance on the stack before starting the timer, or maybe reordering the parameters to get those |
In normal case, I would say overengineering/micro-optimizing is bad, but if its a profiler, go all the way 😛 Its also more about what happens inside |
Alright, I'll try to take care of those things soon, although,
I still don't quite understand how
Also another note, if it seems that block tick can be excessive, note that by default tick times are not normalized, so block tick times will be computed only by the amount of time the ticks took to run divided by the amount of ticks the block ticked for (which is usually only ~1-2 ticks) instead of the number of ticks the profiler ran for, so it can seem that blocks/fluid ticks such as water flows are extremely excessive. You can change the behavior of this by clicking the 'Normalize' button in the settings window. Thinking about it now, maybe it would be better to have normalization on by default? |
Wait, no, you're right, wtf. I dont know why, but before I read it as |
Alright, I'll close this, but is your concern that it's taking a constant 50 us/t throughout the entire profiling duration? Because if so, it's probably not. Did you try normalizing the profiling results? |
These are the 2 pieces of code in question:
observable/common/src/main/java/observable/mixin/ServerLevelMixin.java
Lines 34 to 36 in 02206ce
observable/common/src/main/kotlin/observable/server/Profiler.kt
Lines 43 to 50 in 02206ce
Profiler adds all of
TimingData
setup creation (HashMaps, etc) in the same boat asstate.tick()
.The correct order of operations would be something along the lines of:
Create timing data instance with all the info first, then measure start time, then run tick(), then add to timing info. The
timingInfo.ticks++;
could be at end, because its so trivial, but I still like to move it there.The text was updated successfully, but these errors were encountered: