all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* `start-process' awfully slow
@ 2013-04-13 15:31 York Zhao
  2013-04-14 18:24 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: York Zhao @ 2013-04-13 15:31 UTC (permalink / raw)
  To: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-20 17:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-13 15:31 `start-process' awfully slow York Zhao
2013-04-14 18:24 ` Stefan Monnier
2013-04-20 17:03   ` York Zhao

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.