From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.devel Subject: Re: cc-mode fontification feels random Date: Thu, 10 Jun 2021 21:06:22 +0200 Message-ID: <20210610190622.7xhpi3umdmuiyiw5@Ergus> References: <83o8cge4lg.fsf@gnu.org> <62e438b5-d27f-1d3c-69c6-11fe29a76d74@dancol.org> <83fsxsdxhu.fsf@gnu.org> <83pmwudgw3.fsf@gnu.org> <20210610151647.qtt7pqbjhdtp6coe@Ergus> <87wnr191iw.fsf@telefonica.net> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13137"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: =?utf-8?B?w5NzY2Fy?= Fuentes Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jun 10 21:07:15 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 1lrQ1K-0003IK-NV for ged-emacs-devel@m.gmane-mx.org; Thu, 10 Jun 2021 21:07:14 +0200 Original-Received: from localhost ([::1]:47838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrQ1J-0001r9-1X for ged-emacs-devel@m.gmane-mx.org; Thu, 10 Jun 2021 15:07:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrQ0g-0001Bs-LB for emacs-devel@gnu.org; Thu, 10 Jun 2021 15:06:34 -0400 Original-Received: from sonic303-3.consmr.mail.bf2.yahoo.com ([74.6.131.42]:38448) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lrQ0d-0003yZ-FX for emacs-devel@gnu.org; Thu, 10 Jun 2021 15:06:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1623351989; bh=0nUyeA3D6XCo8kAkj0FPh/WD+2SIMp/Elw2JLe1eGW4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=qNPsKCFzD2bDau91/4zaaaZK/wy6lotAnlWOeRh/FpPs+bFVeR9Bk60rrbqeDixBbYJjtTpXrSZv7ilsojZp07YZSf/bbN6Aimr3HKSZ7c/1ltFq7YPGHUMh5WOBs3XicUyp2TwDLMQcxJAcY3/NroOBpPKnbLSi9U5XQhln9tEC/NJ4mx2Tr/OEr1sR/G4EZ05QFWE4k7N6ioQcHCaWoV36WeXK0P8sIzhclG/UhczEVLNuJPTr61FdnnYB9EVhBHb6awwwO1HL7m/KGE7xFsnDyGW7m6wIg2v+AhFf8ULCVM7fo0zqZfRv1r0fzbR5UWX/RDTI/MSMjqz3nG5Izw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1623351989; bh=aoV+FGh8DVDkKAB0Qq4EcjnuR5WZ3ofoVeQTanmYKMC=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=nn0ymNOiGm8JqZVmulVp9j78HWrtFVva1A2kWGZMsNOk5+p7yYnclB5s6N2By1p/YqsAo2mZdO/Ox/BoNpXxNPwQJq4e70CDtgw7uPWyls2YPY5CazcJ3p1542sl/dxxE5AQHlwlQFBaDjKV823uxHJkn6oqzO0lj9fc4P6tsZJvGYu+eEoJJpNUk4hF4ZJOHHWVV78jUJteJOvAj7NhPJoqeaLQ8CswSoub4qk/0pZIW2K4JlJtUnmZcNSIAVntR9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000 Original-Received: by kubenode554.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 5234ec0b512a899656b761943c0ed364; Thu, 10 Jun 2021 19:06:26 +0000 (UTC) Content-Disposition: inline In-Reply-To: <87wnr191iw.fsf@telefonica.net> X-Mailer: WebService/1.1.18368 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Received-SPF: pass client-ip=74.6.131.42; envelope-from=spacibba@aol.com; helo=sonic303-3.consmr.mail.bf2.yahoo.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, RCVD_IN_MSPIKE_H2=-0.001, 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:270669 Archived-At: On Thu, Jun 10, 2021 at 05:34:31PM +0200, �scar Fuentes wrote: >Ergus writes: > >> For things like font-lock/display engine I only consider to do as much >> as possible in the C side to improve performance. And reduce as much as >> possible interacting with the lisp side... Do you think that it may be >> possible? > >Before going this route, we need to check if native-comp is enough of an >improvement and, if it isn't, try to improve it. > > I work very extensively with jit compilers and similar and with different architectures (ARM, ePIC, Intel). In my experience the JIT improvement in performance is very significant compared to bytecode. Specially for a similar code the difference in time can be 1 or even 2 orders of magnitude better. BUT When translating from high level languages (my experience: cpython and julia) it requires much more effort, optimization and time to improve the compiler to get just a same order or performance than a similar C code. Just creating a low level "intrinsic" or "binding" saves time and relies in many other optimization the C compiler already have. Ex: AOS vs SOA, vectorization, parallelization and similar optimizations are very easy to do at low level (or give the hints to the compiler to do them). But it is extremely hard to teach a high level compiler to do themq; basically because of the data structures and types we use in high level languages. That's why in python it is so extended to use libraries like Pandas or Numpy. And every time more and more python packages are just interfaces to C libraries. Julia on the other hand provides C primitives for everything and has primitive data types to give more hints to the compiler... but even with that in real code it can't compare to Python+numpy. Other languages like PHP have a very good compiler improved for decades, but even with that, they have moved a lot of their functionalities to C code with some bindings. Font locking is a dynamic feature and affects responsiveness, and must be executed in the background constantly, so even fast will be never too fast. Responsiveness is an usual complain when new users come from different editors. But also the languages syntax are expected to become more complex with the time. In our case, just accessing the buffer content and passing directly to tree-sitter in C will be almost trivial at the low level, without types conversions or extra copies; but also when we receive the output, processing them with the json library we already link against will be orders of magnitude simpler and faster, instead of converting them to lisp object and stressing the gc with temporal objects we don't really need, and then iterate on the lisp level. Sadly not all the architectures are supported by libgccjit either. So a low level call-preprocess solution will work faster for everyone. Specially for those that still use emacs 23 due to the speed feeling.