Skip to content

Cache root background atoms to avoid repeated XInternAtom calls - #44

Open
jEsuSdA wants to merge 1 commit into
tycho-kirchner:masterfrom
jEsuSdA:fix/cache-root-background-atoms
Open

Cache root background atoms to avoid repeated XInternAtom calls#44
jEsuSdA wants to merge 1 commit into
tycho-kirchner:masterfrom
jEsuSdA:fix/cache-root-background-atoms

Conversation

@jEsuSdA

@jEsuSdA jEsuSdA commented Jul 2, 2026

Copy link
Copy Markdown

Summary

Caches root background atoms (_XROOTPMAP_ID, _XSETROOT_ID) on first use to eliminate repeated XInternAtom() calls every time the root background is painted.

Problem

root_create_tile() calls XInternAtom() for each root background property every time it is invoked. Atoms are fixed X server-side identifiers that never change during a session, so this is an unnecessary round-trip.

Solution

Cache the atoms in a static array on first call to root_create_tile() and reuse them on subsequent calls. A static atoms_cached flag ensures the cache is only populated once.

Scope

  • Only cm-root.c is touched
  • make clean && make produces zero warnings, zero errors

Impact

Eliminates 1–2 XInternAtom() calls per root background paint. Minor performance improvement, but trivial and correct.

root_create_tile() calls XInternAtom() for each root background property
every time it is invoked. Atoms are fixed X server-side identifiers that
never change during a session, so this is an unnecessary round-trip.

Cache the atoms once in a static array on first call and reuse them.
This eliminates 1-2 XInternAtom() calls per root background paint.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant