sb-ext::run-program slow response time using threaded sbcl with poll support under slime
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Low
|
Unassigned |
Bug Description
When using emacs/slime and sbcl with thread + poll support, I noticed slow response times while executing external commands (more than 1 second to execute hostname):
CL-USER> (time (sb-ext:run-program "/bin/hostname" '()))
Evaluation took:
1.062 seconds of real time
0.004222 seconds of total run time (0.002214 user, 0.002008 system)
0.38% CPU
3,822,252,932 processor cycles
16 bytes consed
Without thread support, or if I force slime communication style to :FD-HANDLER, I get a normal response time:
$ cat ~/.swank.lisp
(setq SWANK:*
CL-USER> (time (sb-ext:run-program "/bin/hostname" '()))
Evaluation took:
0.051 seconds of real time
0.001575 seconds of total run time (0.001575 user, 0.000000 system)
3.92% CPU
184,040,468 processor cycles
0 bytes consed
Tests have been done under freebsd 11 / emacs 25.2.1 / slime 2.19 / sbcl 1.3.19. Same king of behavior has been reported under darwin by another user.
$ uname -a
FreeBSD foo.localdomain 11.0-RELEASE-p9 FreeBSD 11.0-RELEASE-p9 #0: Tue Apr 11 08:48:40 UTC 2017 <email address hidden>
$ sbcl --version
SBCL 1.3.19
*features*
(:QUICKLISP :SB-BSD-
:ASDF2 :ASDF :OS-UNIX :NON-BASE-
:64-BIT-REGISTERS :ALIEN-CALLBACKS :ANSI-CL :ASH-RIGHT-VOPS :BSD
:C-STACK-
:COMPARE-
:FP-AND-
:IMMOBILE-CODE :IMMOBILE-SPACE :INLINE-CONSTANTS :INTEGER-EQL-VOP
:LINKAGE-TABLE :LITTLE-ENDIAN :MEMORY-
:OS-PROVIDES-
:OS-PROVIDES-
:OS-PROVIDES-
:RAW-INSTANCE-
:SB-PACKAGE-LOCKS :SB-SIMD-PACK :SB-SOURCE-
:SB-UNICODE :SBCL :STACK-
:STACK-
:STACK-
:UNDEFINED-
After investigation, the delay of one second is generated by the (process-wait) function defined in src/code/
(serve-all-events), rely on (sub-sub-
;; If invoked with no descriptors only for the effect of waiting
;; until the timeout, make a valid pointer to a (struct pollfd).
I my case (threaded sbcl running under slime), no descriptors are invoked, so the command waits for one second before returning. Therefore, the call to (process-wait) takes ~ 1s. When switching slime communication style to :FH-HANDLER, call to (process-wait) is faster, as (sub-sub-
I wondered if the call to (serve-all-events 1) under (process-wait) might be improved (at least reducing the timing?).
affects: | sbcl → null-and-void |
information type: | Public → Private |
Changed in null-and-void: | |
status: | New → Invalid |
information type: | Private → Public |
affects: | null-and-void → sbcl |
Changed in sbcl: | |
status: | Invalid → New |
Changed in sbcl: | |
status: | New → Triaged |
importance: | Undecided → Low |
summary: |
- sb-ext::run-process slow response time using threaded sbcl with poll + sb-ext::run-program slow response time using threaded sbcl with poll support under slime |
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
92aa401293bb94d 3585b5947f000e0 26714dc10e