doomemacs / doomemacs/core

Input lag when pressing backspace in OCaml buffers with many comments

Open
#8,620 0 comments 0 reactions 0 assignees View on GitHub
is:bug re:perf re:smartparens
Dominant language
Emacs Lisp
Stars
22.7k
Forks
3.1k
Avg merge
10h 46m
Merged PRs (30d)
4

Description

### Describe your issue

When I press backspace in an OCaml buffer with many comments, it can take about a second to delete the character. This happens when editing code, but not the comments themselves. Typing code or comments does not cause lag, and pressing DELETE is responsive. [Here](https://0x0.st/P-3c.txt) is the CPU profiler report when deleting `true` from `let test = true` in a file with many comments. This happens with my personal config and the vanilla config. This is solved by switching from `smartparens-mode` to `electric-pair-local-mode`.

```emacs-lisp
;;; add to $DOOMDIR/config.el
(add-hook! 'tuareg-mode-hook
(smartparens-mode -1)
(electric-pair-local-mode 1))
```

### Steps to reproduce

1. Grab [this](https://github.com/cs3110/textbook-solutions/blob/main/chapter10.ml) solution file from the textbook OCaml Programming: Correct + Efficient + Beautiful
2. Go somewhere further into the file, like line 233, and enter `let test = true`
3. Press backspace to experience the lag

### System information

https://0x0.st/P-3B.txt

### Disclosures

- [ ] This issue was written with/by AI.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.