Stellarium / stellarium

Stellarium is a free GPL software which renders realistic skies in real time with OpenGL. It is available for Linux/Unix, Windows and macOS. With Stellarium, you really see what you can see with your eyes, binoculars or a small telescope.
https://stellarium.org
GNU General Public License v2.0
7.61k stars 817 forks source link

Cache UTC offset #3898

Open gzotti opened 1 week ago

gzotti commented 1 week ago

Finding UTC offset is surprisingly costly but is executed per-frame, shown in VTune. Caching the result per-minute saves at least part of it.

This needs some testing.

Description

Fixes # (issue)

Screenshots (if appropriate):

2024-09-16d getCommonInfoString_UTCoffset

With this caching: 2024-09-16e cachedUTCoffset

Type of change

How Has This Been Tested?

Test Configuration:

Checklist:

github-actions[bot] commented 1 week ago

Great PR! Please pay attention to the following items before merging:

Files matching src/**/*.cpp:

This is an automatically generated QA checklist based on modified files.

10110111 commented 1 week ago

What is the performance benefit from this? Is it even measurable in any way except by using a profiler?

gzotti commented 1 week ago

What is the performance benefit from this? Is it even measurable in any way except by using a profiler?

I just wondered what takes so long just displaying InfoText. The commonInfoString was a surprisingly costly part of it, and here this seemingly trivial UTC lookup appears to be far from trivial.