From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: cc-mode fontification feels random Date: Fri, 04 Jun 2021 14:46:12 +0100 Message-ID: <878s3pzqsb.fsf@gmail.com> References: <831r9iw473.fsf@gnu.org> <87h7ieyma7.fsf@gmail.com> <83wnr9vrpj.fsf@gnu.org> <83o8clvpq4.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22693"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: p.stephani2@gmail.com, dancol@dancol.org, theo@thornhill.no, ubolonton@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jun 04 15:48:01 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lpAB7-0005k9-3N for ged-emacs-devel@m.gmane-mx.org; Fri, 04 Jun 2021 15:48:01 +0200 Original-Received: from localhost ([::1]:54414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpAB5-0000n9-R5 for ged-emacs-devel@m.gmane-mx.org; Fri, 04 Jun 2021 09:47:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpA9T-0007Qj-FH for emacs-devel@gnu.org; Fri, 04 Jun 2021 09:46:19 -0400 Original-Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:38577) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lpA9R-0005gk-QK; Fri, 04 Jun 2021 09:46:19 -0400 Original-Received: by mail-wr1-x42e.google.com with SMTP id c9so698609wrt.5; Fri, 04 Jun 2021 06:46:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=jrAON5jZpc7azIwNQ9dHkGiBMnzscu5X/vCj5V3IQKw=; b=ARxn2GLnejeQrMPZu0MOw4ade8AMrUOYKgxPM4Y/LghHEKnmeYF27L6WWAm6A+tJzs lYdaLQK10Hhfq1ffSvMeZtK1ZU9tnqgzOKBo7tlZL0dVWVUanEx9z8v21WDQ6x03oHii x9oXkVMJtaqfc7J23I/CMuMMJAz8jsxMrwJ/rzVWYk+94cZ5n745W+CyYxw/ylzU7Mfm ZQAPupEm9qjPxan/A+MoXl/qsa/BOAtZpLiskuUPewv64w305JwEf1gr6e9AGUg55S0J z2mbFFRbjmzOcQythLbke+DqI2D6aWd8IImXlHb6aC1lNidkD8MM8YQuT3kfFqKeJbMt EVkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=jrAON5jZpc7azIwNQ9dHkGiBMnzscu5X/vCj5V3IQKw=; b=GL6p/N6dUZ/oyTGTNSCA/xGzn0raR4W8EyU1xsWzX81oulw2tkKrGM3jTv6hKBuQpZ MYKr43NB47/+nNXFCUAwcL3qLbSIXgzlmxXjKrE3LJm1tvnWzQ1U85AGjozvY8O0yTug uMaEDG0emkC3xc4oTV0oYMcVsGV6k4w/33eZK6DQEWD9Gc4+NOJPk9vLEOHQCXHxaObc ifHFDNznFCS/GEKUgIuHHfaCUbXFv4+uXXegJr2drkvUP+yO0ffDQCoyhilFvyEsakIb cEyqsfambM+/DFnExkYdpeHCQQLi1gGYV1xnka88dW4kHggEjOMiruNZ+f6V18VFEG+y lDAw== X-Gm-Message-State: AOAM530I5wLXzCyQJLxI97AVW5BLkdnMYb+H5Gxs4JaIe0+kIySMyR5v vmExLDOu8wkysaAp8jRgsxd3NcRlVIA= X-Google-Smtp-Source: ABdhPJypfocy87Enw5UjhoCZEMwjK0FcQ91gInu6CDWp8g4uafkL3jEFD86dkRFwaShMovevW27lLQ== X-Received: by 2002:adf:f68a:: with SMTP id v10mr4077083wrp.58.1622814374514; Fri, 04 Jun 2021 06:46:14 -0700 (PDT) Original-Received: from krug (89-180-155-72.net.novis.pt. [89.180.155.72]) by smtp.gmail.com with ESMTPSA id r7sm10997873wma.9.2021.06.04.06.46.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 06:46:14 -0700 (PDT) In-Reply-To: <83o8clvpq4.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 04 Jun 2021 14:22:43 +0300") Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=joaotavora@gmail.com; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:270386 Archived-At: Eli Zaretskii writes: >> a big and complex buffer would give rise to one of these big and complex >> JSON messages. > Ask Dmitry about performance problems with native JSON support, and > the effort we invested (a year ago?) into optimizing UTF-8 encoding of > strings, to squeeze every last percent of performance. As I remember, the biggest bottleneck was parsing and allocating Lisp objects. Commonly, it means parsing a big JSON message even if you're only interested in a fraction of it (and this happens in LSP when e.g. some servers decide to serve up huge buckets of diagnostics unrelated to the current file being edited, for instance). The json.c parser is faster, but ultimately borks here, too.=20=20 My idea at the time was to develop a technique to only parse the bits of JSON we're interested in, which dramatically improved performance. I had a prototype for json.el lying around (can't seem to find it) based on lazy evaluation. If I remember correctly, Dmitry proposed another technique based on a "path/selector language", which can also work but is not quite so elegant IMO. Of course, this is only useful if the starting assumption of much useless JSON garbage is indeed true. And I don't get a lot of bug reports in Eglot about big-and-slow JSON, so it's been off the radar for a while. And again, for fontification, this point is probably moot if we're going to integrate tree-sitter directly with direct access to the buffer (which just makes sense). Jo=C3=A3o