From 3cd2b528bfbe29913c30e3b66309d03dcdc7bedc Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 5 Jan 2026 18:37:28 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20Bolt:=20Optimize=20drw=5Fmap=20by?= =?UTF-8?q?=20replacing=20XSync=20with=20XFlush?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaced XSync with XFlush in drw_map to reduce latency during drawing operations. XSync forces a round-trip to the X server, which is unnecessary for simple drawing commands and can cause performance bottlenecks. XFlush ensures requests are sent without blocking. --- .jules/bolt.md | 5 +++++ drw.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .jules/bolt.md diff --git a/.jules/bolt.md b/.jules/bolt.md new file mode 100644 index 00000000..760cb0a3 --- /dev/null +++ b/.jules/bolt.md @@ -0,0 +1,5 @@ +# Bolt's Journal + +## 2024-05-22 - [First Entry] +**Learning:** Initial setup of the journal. +**Action:** Record future performance insights here. diff --git a/drw.c b/drw.c index 7e99a386..28e915e6 100644 --- a/drw.c +++ b/drw.c @@ -494,7 +494,13 @@ 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); + /* + * Optimizing performance by replacing XSync with XFlush. + * XSync forces a round-trip to the X server, waiting for all requests to be processed, + * which causes latency in drawing operations. XFlush ensures the request is sent + * without blocking the client. + */ + XFlush(drw->dpy); } unsigned int drw_fontset_getwidth(Drw *drw, const char *text) {