GNU bug report logs -
#32728
Emacs slow when reading process output
Previous Next
Full log
View this message in rfc822 format
Actually, my benchmarking is somewhat wrong.
start-process with a filter, but discard output:
(let ((coding-system-for-read 'binary))
(kill-buffer (get-buffer-create " *zeroes*"))
(benchmark-run
1
(let ((proc (start-process "dd" (get-buffer-create " *zeroes*") "dd"
"if=/dev/zero" "bs=4096" "count=250000")))
(set-process-filter proc (lambda (proc string)))
(while (and (process-live-p proc)
(accept-process-output proc 1))))))
=> (18.828236636 59 13.315468088000017)
filter, but insert the output:
(let ((coding-system-for-read 'binary))
(kill-buffer (get-buffer-create " *zeroes*"))
(benchmark-run
1
(let ((proc (start-process "dd" (get-buffer-create " *zeroes*") "dd"
"if=/dev/zero" "bs=4096" "count=250000")))
(set-process-filter proc (lambda (proc string)
(with-current-buffer (get-buffer " *zeroes*")
(goto-char (point-max))
(insert string))))
(while (and (process-live-p proc)
(accept-process-output proc 1))))))
=> (21.120281346 59 13.250166416000013)
With the default filter:
(let ((coding-system-for-read 'binary))
(kill-buffer (get-buffer-create " *zeroes*"))
(benchmark-run
1
(let ((proc (start-process "dd" (get-buffer-create " *zeroes*") "dd"
"if=/dev/zero" "bs=4096" "count=250000")))
(while (and (process-live-p proc)
(accept-process-output proc 1))))))
=> (34.046986424 116 26.025843717999976)
(!)
So the default filter is really slow?
Anyway, compare with call-process:
(let ((coding-system-for-read 'binary))
(kill-buffer (get-buffer-create " *zeroes*"))
(benchmark-run 1 (call-process "dd" nil (get-buffer-create " *zeroes*") nil "if=/dev/zero" "bs=4096" "count=250000")))
=> (1.694743653 0 0.0)
So what makes start-process 10x slower than call-process? If it is all
the string creation before calling the filters, default or not, then my
point stands, but this obviously requires a more in-depth dive into
process.c.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 5 years and 300 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.