Replace font-lock with low-level implementation #49
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The fontification logic is changed from a syntax table based to a text based implementation.
Benchmarks:
bench-jsonianon themainbranch: 8.572sbench-jsonianon the new branch: 4.204sbench-prog: 5.794sbench-fundamental: 5.862sbench-fundamental-keyword-only: 0.105sWhen
font-lock-keywords-onlyis nil,font-lock-fontify-regiontook more than 5 seconds even in the fundamental mode. If it is non-nil,font-lock-fontify-regionis instantaneous.Drawbacks:
syntax-ppss, some functions likeforward-sexporend-of-linetook a fraction of a second (e.g. 0.37s) for the first time.jsonian.Bonus:
Discussion:
Does this offer real benefit? Emacs' font locking is smart enough to fontify only a fraction of the buffer, so opening a large file or moving to the end of the buffer is instantaneous (unless the contents of the file is a single long line). Can we justify a long and complex implementation?