From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: CC Mode -> Tree sitter challenge Date: Sat, 5 Nov 2022 18:13:14 -0700 Message-ID: <4E432374-A97A-48A0-A1C8-89C1DB47A7F8@gmail.com> References: <87v8nu1mt1.fsf@thornhill.no> <83eduh4vcf.fsf@gnu.org> <87mt951r69.fsf@thornhill.no> <83tu3d34u7.fsf@gnu.org> <87eduhxy9l.fsf@thornhill.no> <83pme130xs.fsf@gnu.org> <717833B0-285B-460F-B37B-F0B215BD1185@thornhill.no> <3A13DCFD-3306-492B-8022-DCE95EC340A3@thornhill.no> <87a655xspj.fsf@thornhill.no> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) 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="27401"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, Eli Zaretskii , monnier@iro.umontreal.ca To: Theodor Thornhill Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 06 02:14:12 2022 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 1orUEl-0006tc-P3 for ged-emacs-devel@m.gmane-mx.org; Sun, 06 Nov 2022 02:14:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1orUDx-0003x5-O3; Sat, 05 Nov 2022 21:13:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1orUDv-0003wv-TF for emacs-devel@gnu.org; Sat, 05 Nov 2022 21:13:19 -0400 Original-Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1orUDu-0002cI-By; Sat, 05 Nov 2022 21:13:19 -0400 Original-Received: by mail-pf1-x433.google.com with SMTP id d10so7658870pfh.6; Sat, 05 Nov 2022 18:13:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=HZj0ESWp6IvJRDT0VVOlztiBqJ2ZEbLrKc0N+HdQhQ4=; b=euYckJdTC4AzyuXv5cUs0M3prijCVhUrff0AhU0MCCfwXpPKl8TEbdM4lTxSL5RiC/ 7psQGJ/SKTIcC3q7v3x4JOvopEukSQgayRRVmnlofdd1H/byrnGzQBFc8jL0pSFLWddh J8g87XMDa9G2qe7wHMi0nfHotRz1edWJSPzT+NAZuQvo1sLSnHe0eK8h+ceEooKbhEhf SN5k7+UdtSVtI8mBv0RUoB5QigHsAi15OVeUpQ6jbtHjNWxnhvkUsZ93wu1m8RSKdYin J7qUkOjInvYZh9pdKk+F1mQiHdyP8JjXrxeoN+PohynaSeVqwFWM45ENYAxPpBkOVFOO Rp2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HZj0ESWp6IvJRDT0VVOlztiBqJ2ZEbLrKc0N+HdQhQ4=; b=I2R2dONRssdLy1ZEPIOg+Ok5hzycvdccrELTmbCQCcAxvPj3AsGEx4JTpbc5DkCtfO WaCAKb45UPjRECTXL+t1WVmu9KvQTYdUNfCR54NERKKnjNoe/b+IQpM5NteI8u3MAuL0 z5MtwURAWOopDQ47PsVRXtdrZu9HA74b1koZb8Jocsvxy10cx/nzYKlA1sw9o3xU7QLq nc5kQtK3K3O1MOtImDh1setOTOrqfTcFCTOpkhwhDRxGDvGarWtv2EcrOcxdXVmxOuoF Ebx/LOSMJwCCB1F2yz/BVNldrS3mq0u/OU7NjCfItYdcY+nAkRT2YOtyiNdFIPmdVBXA y41Q== X-Gm-Message-State: ACrzQf3X5ihBJndx+CIR3c5ozCBz0BgJnc9h7NbXvIfvSCKnS37xcSfL aHqJ2arc8aurc1QJAN/rxd0= X-Google-Smtp-Source: AMsMyM5zHI5Jw+/e2smBswjcg9lDf2EuBeaq+DYQfK7QJtOp/KNoZdt14RAo1BeSbtg945rQR3v+qg== X-Received: by 2002:a63:1953:0:b0:438:a46b:63f2 with SMTP id 19-20020a631953000000b00438a46b63f2mr584337pgz.572.1667697196581; Sat, 05 Nov 2022 18:13:16 -0700 (PDT) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id e9-20020a170902784900b00183e2a96414sm2225076pln.121.2022.11.05.18.13.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 Nov 2022 18:13:16 -0700 (PDT) In-Reply-To: <87a655xspj.fsf@thornhill.no> X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=casouri@gmail.com; helo=mail-pf1-x433.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.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "Emacs-devel" Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:299236 Archived-At: > On Nov 5, 2022, at 9:38 AM, Theodor Thornhill = wrote: >=20 >=20 > Hi again, Eli! >=20 >>>=20 >>> Interesting. My guess is that there are still some improvement = possible in the indent-region code, considering that part of treesit.el = is quite new. >>>=20 >>> What do you think, Yuan? Any thoughts? >>>=20 >>> Anyways, I'll keep working on this and see how far I get next coming = weeks. At least in performance it seems I have a good thing going here = :-) >>>=20 >>=20 >> Thinking of it, some of the indentation questions isn't compiled. = I'll run it again later when they are compiled as well :-) >>=20 >=20 > Yes, that was the issue. Now the scores are as follows: The indentation code has a list of rules, and it runs each rule = top-to-bottom until one rules matches, then it uses that rule to = determine how much to indent. The ordering of each rule could be tweaked = so that most frequent case comes forward. We can also arrange these = rules not linearly but in a tree, so if one rules matches/doesn=E2=80=99t = match, some other rules can be skipped. What exactly did you compile? I tried byte-compiling indentation rules = before but didn=E2=80=99t see a significant speed-up. Yuan=