all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#74357: c-mode: Some syntactic constructs cause unreasonable typing lag
@ 2024-11-14 20:39 Björn Lindqvist
  2024-11-15  7:40 ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Björn Lindqvist @ 2024-11-14 20:39 UTC (permalink / raw)
  To: 74357

This bug has been present in c-mode for at least a year, but I haven't
gotten around to report it. The reason is that bugs about latency are
erratic and tricky to triage. Typing when the cursor is on some
syntatic constructs in c-mode causes severe lag on the order of several
hundred milliseconds on my (admittedly slow) laptop. The lag
makes c-mode almost unusable. Here is an MWE:

    void foo(uint dc_dim, uint sc_dim,
             uint fy_dim, uint fx_dim,
             __global const float * restrict F,
             uint sy_dim, uint sx_dim,
             __global const float * restrict S,
             uint padding,
             __global float * restrict D) {
        uint dy_dim = sy_dim + 2 * padding - fy_dim + 1;
        uint dx_dim = sx_dim + 2 * padding - fx_dim + 1;

        // Place cursor at "y" in "dy_dim". Hold "y" and observe lag.
        uint dn = dc_dim * dy_dim * dx_dim;
        uint sn = sc_dim * sy_dim * sx_dim;
    }

I can make typing even laggier by wrapping foo in foo, like this:

    void foo(...) {
    ...
    void foo(uint dc_dim, uint sc_dim,
             uint fy_dim, uint fx_dim,
             __global float * restrict F,
             uint sy_dim, uint sx_dim,
             __global float * restrict S,
             uint padding,
             __global float * restrict D) {
        uint dy_dim = sy_dim + 2 * padding - fy_dim + 1;
        uint dx_dim = sx_dim + 2 * padding - fx_dim + 1;

        // Place cursor at d[y]_dim. Hold "y". Observe lag in c-mode.
        uint dn = dc_dim * dy_dim * dx_dim;
        uint sn = sc_dim * sy_dim * sx_dim;
    }
    }

The more times I wrap foo the slower c-mode gets. So if you have a
fast computer try nesting foo in foo 50 times... I have observed the
same annoying input lag on multiple computers and I don't use any
special c-mode configuration.

Please cc me as I'm not subscribed to the list.

GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43,
cairo version 1.18.2)


-- 
mvh/best regards Björn Lindqvist





^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-12-10 10:43 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-14 20:39 bug#74357: c-mode: Some syntactic constructs cause unreasonable typing lag Björn Lindqvist
2024-11-15  7:40 ` Eli Zaretskii
2024-11-15 14:08   ` Björn Lindqvist
2024-11-15 14:25     ` Eli Zaretskii
2024-11-15 14:45       ` Alan Mackenzie
2024-11-15 21:43       ` Björn Lindqvist
2024-11-16 11:00         ` Eli Zaretskii
2024-11-28 20:03         ` Alan Mackenzie
2024-11-29 23:18           ` Alan Mackenzie
2024-11-30 18:04             ` Björn Lindqvist
2024-11-30 18:33               ` Alan Mackenzie
2024-11-30 20:07                 ` Björn Lindqvist
2024-12-01 17:49                   ` Alan Mackenzie
2024-12-06 20:53                     ` Björn Lindqvist
2024-12-10 10:43                       ` Alan Mackenzie

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.