Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Limit logs in Timer function to not affect performance #130
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
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.
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 ).