WAROQUIERS Philippe <[email protected]> writes:

> Performance problem:
> On one of our biggest files, the initial loading/parsing of the file blocks 
> the emacs
> during 10 seconds.

We need a benchmark here.

The slowest file I've dealt with is
gnatcoll-1.6-src/src/gnatcoll-projects.adb. That's in gnatcoll-1.6,
packaged with gnat 7.2.

It's 7204 lines, not a lot of nesting.

With ada-mode 5.1.4 byte-compiled, running in emacs 24.3 started with
'emacs -Q':

1) in *scratch*, eval:

(package-initialize)

(defun time-difference (end start)
  "return difference between END and START, as a time value"
  (list
   (- (car end) (car start))
   (- (car (cdr end)) (car (cdr start)))
   (- (car (cdr (cdr end))) (car (cdr (cdr start))))))

(defun time-it (func count)
  "call FUNC COUNT times, show total time"

  (interactive "afunction \nncount ")

  (let ((start (current-time))
        (i 0)
        diff)
    (while (not (eq (1+ count) (setq i (1+ i))))
      (save-excursion
        (funcall func)))
    (setq diff (time-difference (current-time) start))
    (message "Total %f seconds; per iteration %f"
             (time-to-seconds diff)
             (/ (time-to-seconds diff) count))
    ))

(Is there a built-in timing function? I couldn't find one)

2) load gnatcoll-projects.adb

3) C-M-; (time-it 'wisi-parse-buffer 1)

    on my machine, this gives 1.248 seconds (+- 0.02)

    subsequent runs in the same buffer give 2.371, which is very
    interesting!

If you can, please report the parse times on your machine for
gnatcoll-projects.adb; that will give me a better feel for how fast my
machine is.

Also, in ada-france mtn, I've added a new debug feature;
wisi-parse-max-parallel-current. That shows the maximum number of
parallel parsers used in the last parse, and the point at which that max
was spawned.

ada-mode 5.1.4 has the improvement for nested case statements as well,
so updating to that may make it faster on your files, if you are
currently running an earlier version.

gnatcoll-projects.adb has a max of 4 parsers; that quickly goes back to
one in each case.

If you can, please report the max parsers for your slow files; anything
greater than 4 is a candidate for improvement.

--
-- Stephe

_______________________________________________
Emacs-ada-mode mailing list
[email protected]
http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org

Reply via email to