Skip to content
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

Limit logs in Timer function to not affect performance #130

Merged
merged 1 commit into from Aug 17, 2019

Conversation

@and3md
Copy link
Contributor

and3md commented Aug 17, 2019

When I test my game, I noticed that sometimes (very rare, about one time on 20 minutes) the physics freezes, and moving rigid bodies appear about 2 centimeters further (on 5'' screen). Then I discovered that when this happens logs receive a lot of Time: Detected gettimeofday () going backwards on Unix, workarounding. This is known to happen on some Android devices.

There can be about 300 lines with this information. So I tried to limit this logs. After that freezes still occur, but they are shorter, and don't affect physics so much (about 0.5 centimetre).

The log looks better also.
This PR limits this log to one occurrence.

@michaliskambi michaliskambi merged commit 3992a7e into castle-engine:master Aug 17, 2019
@michaliskambi

This comment has been minimized.

Copy link
Member

michaliskambi commented Aug 17, 2019

Thanks! Merged.

We have a few more places in CGE where logs need to be limited to avoid flooding, indeed they can kill performance (and make log hard to read) if they are produced too often. Sometimes I display a log only once (guarded by Boolean), sometimes I limit it to 10 occurrences (like in TTextureFontData.MakeFallbackWarning https://github.com/castle-engine/castle-engine/blob/master/src/fonts/castletexturefontdata.pas#L535 ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.