[TxMt] The overhead of 'Pipe text through' ...
Torsten Grust
grust at in.tum.de
Wed Jan 3 17:20:19 UTC 2007
Dear all,
I'm hacking on a little project that is somewhat abusing the
'Pipe text through' feature of TextMate's Web Preview window
(''abusing'' in the sense that I do not want to preview HTML text).
If you open the Web Preview and uncheck the 'Pipe text through'
option you can observe how rapidly TextMate can update the
preview (set the 'Refresh after change delay' to 0.00s and type
away in some plain text -- the update seems almost immediate and
you'll have immediate typing response in the editor window).
Enabling 'Pipe text through' makes TextMate pipe the current
editor window contents into the specified command. Even if you
only specify 'cat >/dev/null' as that command, you will notice
that text editing will become sluggish. I assume that this
delay is all due to the overhead of *forking* the specified
command -- executing 'cat >/dev/null' itself takes no noticable
time on files of size <100k on my Powerbook G4.
I've got two questions here:
(1) Is there a smarter way to receive live updates of the
current editor window contents? Maybe via the plugin API?
(2) How about a comptabile change in 'Pipe text through's
behavior? If the file specified in 'Pipe text through' is a
named pipe (mkfifo(1)) do not fork any command but simply
write the editor window contents into that named pipe.
Otherwise, behave as before.
Item (2) sounds like a moderate change that could get us rid
of the forking overhead for at least some applications that
need live update. What are the chances that Allan has open
ears for such things?
Thanks and all the best for the New Year,
--Torsten
More information about the textmate
mailing list