News for hackers. Stuff that matters.
Re:You can't copy code with memcpy by __david__ on Thursday December 30, 2021 @02:21AM (#29734503)
See also: Emacs's old unexec() function. How do you speed up a bunch standard library lisp loading and initialization? Just do it once then write a new exe out with all your state pre-computed. Genius.
Re:You can't copy code with memcpy by weinzierl on Thursday December 30, 2021 @05:17AM (#29735416)
Yup, and early TeX did it too. You could run a memory dump of a previously initialized version to improve start-up times.

For a modern take on similar idea see also this discussion from a while ago:

"Improving startup time in Atom with V8 snapshots"

https://news.ycombinator.com/item?id=14140421

Re:You can't copy code with memcpy by WalterBright on Thursday December 30, 2021 @03:06AM (#29734726)
I stole that idea from the 1970's FORTRAN program ADVENT, the precursor to Zork.

I was amazed that I never ran across another DOS program that used the technique.

Re:You can't copy code with memcpy by barchar on Saturday January 01, 2022 @10:18PM (#29765454)
there's also unfork(2)!

Do you unfork then unexec or unexec then unfork?