-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The highlighting code should be optimised #5326
Comments
Perhaps the new representation can also be used for |
5 years ago Guilhem Moulin was working on this, but this wasn't merged. Maybe Guilhem still has the patches. They were on a separate repo. I had also looked around for better representations. There are some libraries for interval trees on hackage, but I didn't find one back than that implemented what I wanted. |
The new code can be considerably faster for files with very many mutual blocks.
I've implemented some different data structures and run some benchmarks (
|
Excellent!
Yes, I think it is good to separate the data structure ( Please open a PR so we can have a structured discussion with the conveniences offered by the PR functionality. |
The new code can be considerably faster for files with very many mutual blocks. The highlighting of some symbols have changed. See for instance test/interaction/Issue3020.agda, where the definition B is now highlighted as a function instead of as a bound variable. The reason is presumably that mappend is not associative for the type Aspects.
Another comment: The append function ( |
No, this was due to a mistake I made. |
The new code can be considerably faster for files with very many mutual blocks.
The new code can be considerably faster for files with very many mutual blocks.
I opened a separate issue related to how append is not associative (#5347). The code passes all the tests now. It took me a few iterations to get the code to work for old versions of GHC. I also changed the implementation. Now the conversion from I assume that it is possible to create a more efficient implementation of |
The new code can be considerably faster for files with very many mutual blocks.
Elsewhere I wrote the following:
The
splitC
function is called fromgenerateAndPrintSyntaxInfo
:agda/src/full/Agda/Interaction/Highlighting/Generate.hs
Lines 163 to 164 in aea2c53
I added code that counted the length of
prevTokens
, and this indicates that the worst-case time complexity is at least quadratic in the size of the input file. For instance, consider the following code:For this code we get the following list of lengths: [0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 0]. For "real" code the numbers can exceed 1000.
I suggest that we define
CompressedFile
using a data structure that allows us to implementsplitC
efficiently. One option might be to use a map withRange
s as keys, along with the functionsplitLookup
.The text was updated successfully, but these errors were encountered: