diff --git a/.jules/bolt.md b/.jules/bolt.md new file mode 100644 index 0000000..130a3e9 --- /dev/null +++ b/.jules/bolt.md @@ -0,0 +1,4 @@ + +## 2026-02-03 - XSync in Drawing Loops +**Learning:** `XSync` forces a blocking round-trip to the X server, which is catastrophic for performance in frequently called drawing functions like `drw_map`. +**Action:** Replace `XSync` with `XFlush` in drawing routines where strict synchronization is not required. diff --git a/drw.c b/drw.c index 7e99a38..35362fc 100644 --- a/drw.c +++ b/drw.c @@ -494,7 +494,9 @@ void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, } XCopyArea(drw->dpy, drw->drawable, win, drw->gc, x, y, w, h, x, y); - XSync(drw->dpy, False); + /* Performance: XFlush is sufficient here; XSync causes unnecessary blocking + * round-trips. */ + XFlush(drw->dpy); } unsigned int drw_fontset_getwidth(Drw *drw, const char *text) {