4 ms·
Not sure that’s needed. Sending SIGSTOP (or using cgroup freeze) and letting the linux memory management do its job should do most of that already.
by dividuum 2y ago
Not sure that’s needed. Sending SIGSTOP (or using cgroup freeze) and letting the linux memory management do its job should do most of that already.
- Agingcoder 2y agoYes I confirm it works - I’ve been using this very behavior for years
- paulddraper 2y agoYep, nothing fancy needed
- perihelions 2y agoI've used this to speed-up CLI commands which have a slow startup phase. I run the process up to the point where it finishes initializing things and starts reading input, SIGSTOP there, and resume it later. You can identify that "reading input" library call with strace, and intercept it dynamically with an LD_PRELOAD shim. I haven't yet figured out how to (neatly) persist this to disk, so I just sort of make a mini server-loop that catches signals and dispatches a fork() for each one, and that's my fast version of the CLI command. Delightfully ugly :) (The killer app I'm trying to apply this to is LaTeX, so that I can write math notes in Emacs, incrementally, without visible latency. Unfortunately the running LaTeX process is slightly convoluted, and needs a few more tricks to get working in this way. This trick works on the plain TeX command out-of-the-box (it's like a 50x speedup), so I think I'm on the right track...)
- karthink 2y ago> The killer app I'm trying to apply this to is LaTeX, so that I can write math notes in Emacs, incrementally, without visible latency. See texpresso [1] for one solution that does something like this with the LaTeX process. Another, more conservative solution is the upcoming changes to Org mode's LaTeX previews [2] which can preview live as you type, with no Emacs input lag (Demos [3,4]). [1] https://github.com/let-def/texpresso https://github.com/let-def/texpresso [2] https://abode.karthinks.com/org-latex-preview/ https://abode.karthinks.com/org-latex-preview/ [3] http://tinyurl.com/olp-auto-1 http://tinyurl.com/olp-auto-1 [4] https://tinyurl.com/ms2ksthc https://tinyurl.com/ms2ksthc
- perihelions 2y agoI wasn't aware of either of those, so thank you very much for those referrals I shall take a close look at :) (Are you by chance the author of org-latex-preview, or is it a coincidence of usernames?)
- karthink 2y agoI am one of the authors, should have mentioned. It's not part of Org yet, but should be some time this year.