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: How to add pseudo vector types Date: Fri, 23 Jul 2021 09:25:17 -0400 Message-ID: References: <83h7gw6pyj.fsf@gnu.org> <45EBF16A-C953-42C7-97D1-3A2BFEF7DD01@gmail.com> <83y2a764oy.fsf@gnu.org> <83v95b60fn.fsf@gnu.org> <00DD5BFE-D14E-449A-9319-E7B725DEBFB3@gmail.com> <83r1fz5xr9.fsf@gnu.org> <1AAB1BCC-362B-4249-B785-4E0530E15C60@gmail.com> <83czri67h0.fsf@gnu.org> <46BBFF88-76C3-4818-8805-5437409BEA93@gmail.com> <83wnpq46uk.fsf@gnu.org> <533BD53B-4E85-4E9E-B46A-346A5BBAD0F5@gmail.com> <258CB68D-1CC1-42C8-BDCD-2A8A8099B783@gmail.com> <1a776770-50b7-93cd-6591-c9a5b3a56eb8@gmail.com> <8335s64v10.fsf@gnu.org> <5380C92B-6C15-4490-A1E0-1C3132DBB16A@gmail.com> <83k0li2shw.fsf@gnu.org> <83eebq2mpy.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) 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="29842"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?utf-8?Q?Cl=C3=A9ment_Pit-Claudel?= , Stefan Monnier , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jul 23 15:26:59 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 1m6vCc-0007UH-Ts for ged-emacs-devel@m.gmane-mx.org; Fri, 23 Jul 2021 15:26:58 +0200 Original-Received: from localhost ([::1]:53030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m6vCb-0006L9-OS for ged-emacs-devel@m.gmane-mx.org; Fri, 23 Jul 2021 09:26:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m6vB5-0004Qp-Ri for emacs-devel@gnu.org; Fri, 23 Jul 2021 09:25:23 -0400 Original-Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]:46965) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m6vB4-0002J0-AS; Fri, 23 Jul 2021 09:25:23 -0400 Original-Received: by mail-qk1-x736.google.com with SMTP id i7so1275992qkb.13; Fri, 23 Jul 2021 06:25:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=fn5OfwLcVa1iQOsvWK2Z8BQv1QiKQrwK4ciUvxqa8ho=; b=jy6W73XS1YL6ClJZwsBdSTq4uNa9K2lCtypLdbOSdJEM+dpVEHXQdgn22Fk/VsXcUP OlN/uogi2S+rUllOyB/EdXpU62FLhJPGyFViKQZg1+pR3Td9dz2S/U6KKAxzfe4zGLQY xPCmaqkvTtcYWvSYld2zjHNR7ix8/E9PNICzowX0nOGIKDCParLyENtUld9RY5NYzqKu JGzggmAvtUlCce2TE9W8s8eN/h8Dydu9Omi8bICm+WasHRV9aZ3bvjEQ7nhmlqU1mpN7 32fWjQ0roQGc6X37nSRHqGzH7u57DmMWjnQeadVBNezx76KwFqifxV6NAl5xEnbBhWPu f17w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=fn5OfwLcVa1iQOsvWK2Z8BQv1QiKQrwK4ciUvxqa8ho=; b=U56ZVIzrmKWm5U04SpJz/jTkxkndbR8mFXyoPaiKeIPVBpcQKv1SVN4Hc47blOtOqL mqe07XiJaO5Bmip14YA4cYjJeWluvUXry8Cb22aa/SQkrfremNuSEHeTifY5JxBrxYMD 1RuqywP6ZypqP5Y8kgrfxgr4qZP4VA0gSHJ4S/6/AUa8ZzGAhZyKKg9hZ5oEa+cQGEaG nTKQjckQk/NiNZzj4izgpEEzdWGGKCw06I3fcAoodR34io/DJHNAYvRk6A9i3WAvDGJY BAHo00UCMYYo9PMP6wXHh/dgkblNZx25GEOBTCj8duYXXFK8VBdOKnVCZ1hAx9k5pUjn aKVQ== X-Gm-Message-State: AOAM531hn2TzdHQ6d+iCkCNPno+z+/2FqQ/4nr15eQHINbEoZdmXs3zU ao7iZw2/Pl46GSpYdCjwZUzV/puxwIxabg== X-Google-Smtp-Source: ABdhPJwBqsmfI2NEP1WG8SJBaCJGSBdPyY/Gjr+/aAF4HwlcztXAGMpHDIqff0D/Qi114b8R1s5+HQ== X-Received: by 2002:a05:620a:b86:: with SMTP id k6mr4426369qkh.456.1627046720250; Fri, 23 Jul 2021 06:25:20 -0700 (PDT) Original-Received: from 2603-7080-0302-635e-501b-d938-5abe-a221.res6.spectrum.com (2603-7080-0302-635e-501b-d938-5abe-a221.res6.spectrum.com. [2603:7080:302:635e:501b:d938:5abe:a221]) by smtp.gmail.com with ESMTPSA id p19sm4897825qtx.10.2021.07.23.06.25.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Jul 2021 06:25:19 -0700 (PDT) In-Reply-To: <83eebq2mpy.fsf@gnu.org> X-Mailer: Apple Mail (2.3654.60.0.2.21) Received-SPF: pass client-ip=2607:f8b0:4864:20::736; envelope-from=casouri@gmail.com; helo=mail-qk1-x736.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:271496 Archived-At: > On Jul 22, 2021, at 3:05 PM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Thu, 22 Jul 2021 13:47:20 -0400 >> Cc: Stefan Monnier , >> Cl=C3=A9ment Pit-Claudel , >> emacs-devel@gnu.org >>=20 >>> More generally: is the problem real? If you make a file that is = 1000 >>> copies of xdisp.c, and then submit it to TS, do you really get 10GB = of >>> memory consumption? This is something that is good to know up = front, >>> so we'd know what to expect down the road. >>=20 >> Yes. I concatenated 100 xdisp.c together, and parsed them with my = simple C program. It used 1.8 G. I didn=E2=80=99t test for 1000 = together, but I think the trend is linear. >=20 > That's good to know, thanks. >=20 > So what does TS do if it attempts to allocate more memory and that > fails? Regardless, we'd need some fallback strategy, because AFAIU > many people run with VM overcommit enabled, so the OOM killer will > just kill the Emacs process when it asks for too much memory. Abort, it seems: static inline void *ts_malloc_default(size_t size) { void *result =3D malloc(size); if (size > 0 && !result) { fprintf(stderr, "tree-sitter failed to allocate %zu bytes", size); exit(1); } return result; } >> Also, we don=E2=80=99t call change hooks in replace_range_2, why? >=20 > Because it is called in a loop, one character at a time. The caller > of replace_range_2 calls these hooks for the entire region, once. >=20 >> Should I update tree-sitter trees in that function, or should I not? >=20 > The only caller is casify_region, so you could update there. casify_region doesn=E2=80=99t have access to byte positions. I=E2=80=99ll = leave it as-is, recording change in replace_range_2, if you don=E2=80=99t = object to it. Yuan