help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

`start-process' awfully slow


From: York Zhao
Subject: `start-process' awfully slow
Date: Sat, 13 Apr 2013 11:31:50 -0400

Hi Everyone,

Clang completion is awesome for completion in C++. I'm using
auto-complete-clang.el, but changed a lot to suit my personal favour, of course.
The biggest problem though is the speed, it is painfully slow for completion in
C++ code that uses std library. On Intel i7 16G RAM, Windows 7 it takes 2
seconds for 15,000 lines of completion results to transfer into emacs buffer.
Here is the code snippet:

(defun ac-clang-candidate ()

  ...

  (apply (if ac-clang-asynchronous
             'ac-clang-start-process
           'ac-clang-call-process)
         ac-prefix
         (ac-clang-build-complete-args (- (point) (length ac-prefix)))))

(defsubst ac-clang-build-complete-args (pos)
  (append '("-cc1" "-fsyntax-only")
          (unless ac-clang-auto-save
            (list "-x" (ac-clang-lang-option)))
          ac-clang-flags
          (when (stringp ac-clang-prefix-header)
            (list "-include-pch" (expand-file-name ac-clang-prefix-header)))
          '("-code-completion-at")
          (list (ac-clang-build-location pos))
          (list (if ac-clang-auto-save buffer-file-name "-"))))

So, when `ac-clang-asynchronous' is NOT set, eventually `call-process' will be
called to call Clang executable (clang.exe). Otherwise, `start-process' will
eventually be called. As mentioned above, when `call-process' is used, it takes
2 seconds for Clang to generate 15,000 lines of completion results and then the
results gets received by Emacs in a temporary buffer. 2 seconds is painful but
still OK. Because of the slowness, I tried to add the functionality to be able
to call Clang asynchronously so that the keyboard input will not be blocked
while awaiting the completion results. What had driven me crazy is that it takes
more than 15 seconds for Emacs to receive the 15,000 lines of completion results
if `start-process' is is being used to call the Clang executable. During this 15
seconds I was not typing anything so Emacs is "idling". The question is why
`start-process' takes 15 seconds while `call-process' takes only 2 seconds, and
what can I do about it?

Any help will be greatly appreciated.

Thanks in advance

York



reply via email to

[Prev in Thread] Current Thread [Next in Thread]