Skip to content

file: Rate limit file date string generation

Sebastian Keller requested to merge skeller/nautilus:date-string-cache into master

The date string for a file used in the list view was getting regenerated for every frame when scrolling or resizing, which has become much slower with glib 2.66 due to changes in how it creates the local time zone. This resulted in a very low frame rate (2-3 fps on my machine).

This MR is a combination of António's rate limiting idea and my idea for caching the generated date strings. António's rate limiting was trying to rate limit time zone creation, but that did not entirely fix the issue, because there is no from_unix DateTime variant that accepts a custom time zone. My idea for caching the generated strings would require to monitor for timezone changes, which seems a bit of an overkill for such a thing. So instead use rate limiting on the date string generation, which still causes us to hit the slow path in the glib timezone generation, but now instead of every frame, we only hit it every 2 seconds.

If this is still causing stuttering and no glib improvements are in sight, maybe we need to add the timezone/day change monitor.

Related: glib#2204 (closed)

Merge request reports