I had not been aware of vipe; thank you for sending this! Removing the perl dependency is worthwhile, even if it does not reduce RAM usage. (And I don't know what affects the RAM usage in this case.)
Regarding the portability of your version, * mktemp is not portable; you could use something like the date and process identifier ($$) to create a portable temporary file. (I am actually still curious as to whether there is a reasonable portable approach that is less sloppy than this.) * I don't have /usr/bin/editor; how about you fall back to $(/usr/bin/env which ed)? Even better, just use /usr/bin/env ed directly rather than assigning its path as a string. * Print errors to stderr (>&2). * Quote "$edit" in case the editor has a space in its name. * You haven't handled editor errors. * vipe still is better because it has a man page. Note that I didn't actually try running it nor comparing it to vipe; I'm mostly just read the file you linked, and I didn't even looked very much at vipe.