[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to add pseudo vector types

From: Eli Zaretskii
Subject: Re: How to add pseudo vector types
Date: Thu, 22 Jul 2021 09:38:43 +0300

> Cc: emacs-devel@gnu.org
> From: Clément Pit-Claudel <cpitclaudel@gmail.com>
> Date: Thu, 22 Jul 2021 00:59:31 -0400
> >> Alternatively, keeping the list of changes allows us to maintain a copy of 
> >> the buffer that TS uses for scanning, with updates delayed until TS is 
> >> done scanning.
> > 
> > Having a copy for each buffer that needs parsing doesn't scale.
> Because of time, or because of memory?  

Memory, mostly.

> I though we assumed memory was a non-issue, because tree-sitter's data 
> structures seem to require *a lot* more space than the text of the underlying 
> buffer (in 2018 the main dev said "syntax trees still use over 10x as much 
> memory as the size of the source file.").

You are talking about _adding_ to that another copy of the buffer's
text, which could be many megabytes.  And your proposal means we will
have such copies for many buffers.

As for the TS memory requirements, if they really need 1GB for a 100MB
file (I doubt that), then TS is probably not a good candidate for

> Copying time can be an issue, for sure, but memcpy() is fast these days ^^

You forget the time needed to allocate the memory for the copy, that
could be orders of magnitude slower for large buffers, especially if
there's a lot of memory pressure on the OS.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]