From xemacs-m  Fri Dec 20 12:35:21 1996
Received: from altair.xemacs.org (steve@xemacs.miranova.com [206.190.83.19])
          by xemacs.cs.uiuc.edu (8.8.4/8.8.4) with ESMTP
	  id MAA15077 for <xemacs-beta@xemacs.org>; Fri, 20 Dec 1996 12:35:20 -0600 (CST)
Received: (from steve@localhost)
          by altair.xemacs.org (8.8.4/8.8.4)
	  id KAA14831; Fri, 20 Dec 1996 10:45:11 -0800
Sender: steve@xemacs.org
To: xemacs-beta@xemacs.org
Subject: Re: Inserting into a buffer.
References: <Pine.SGI.3.95.961219034733.22578D-100000@shellx.best.com> <rvn2v965c3.fsf@sdnp5.ucsd.edu>
X-Url: http://www.miranova.com/%7Esteve/
Mail-Copies-To: never
X-Face: #!T9!#9s-3o8)*uHlX{Ug[xW7E7Wr!*L46-OxqMu\xz23v|R9q}lH?cRS{rCNe^'[`^sr5"
 f8*@r4ipO6Jl!:Ccq<xoV[Qz2u8<8-+Vwf2gzJ44lf_/y9OaQ`@#Q65{U4/TC)i2`~/M&QI$X>p:9I
 OSS'2{-)-4wBnVeg0S\O4Al@)uC[pD|+
X-Attribution: sb
From: Steven L Baur <steve@miranova.com>
In-Reply-To: David Moore's message of 19 Dec 1996 23:30:04 -0800
Mime-Version: 1.0 (generated by tm-edit 7.97)
Content-Type: text/plain; charset=US-ASCII
Date: 20 Dec 1996 10:45:10 -0800
Message-ID: <m24thhawcp.fsf@altair.xemacs.org>
Lines: 88
X-Mailer: Red Gnus v0.72/XEmacs 20.0

>>>>> "David" == David Moore <dmoore@UCSD.EDU> writes:

Thanks for the data David.

> Ben Wing <wing@best.com> writes:
Ben> The culprit is surely silly.  Similar problems have happened before.
Ben> 
Ben> Someone please run Quantify or the like (Martin?) on this to find the
Ben> culprit.

I'd still like to see what Quantify says, but this may be enough info.

David> The culprits seem multiple, and at least one is very strange
David> (munmap).

That must be coming from the relocating allocator.  Try running the
same test with it disabled from configure.

David> Profiling with -pg (except in the x and system libraries)
David> under solaris 2.5 on an unloaded sparcserver 5 with 64M of physical
David> memory, compiled with gcc -pg -O4.  Placed Hrvoje's benchmark and
David> wrapper to call it 20 times in a file, bytecompiled and loaded it into
David> an xemacs -q, and ran it.

David> Other benchmarks put a large strain on do_symval_forwarding
David> and Fset also.  I'm not sure why munmap is so expensive relative to mmap
David> under solaris, or it may just be that a resizing mmap is showing up as
David> munmap.  This mmap cost isn't seen in Shane's benchmarks typically.

David> 	Parent-child profile is ellided to show just some of the problem
David> routines from the flat profile.

David> Flat profile:

David> Each sample counts as 0.01 seconds.
David>   %   cumulative   self              self     total           
David>  time   seconds   seconds    calls  ms/call  ms/call  name    
David>   9.85    115.71    31.56  6005492     0.01     0.01  map_extents_bytind
David>   8.55    143.11    27.40  2000391     0.01     0.04  buffer_insert_string_1

buffer_insert_string_1 is the general string entry routine.  I see
map_extents_bytind called indirectly three times in that routine.
Twice before insertion through barf_if_buffer_read_only() (via
verify_extent_modification()) and adjust_extents(), and once after
insertion through splice_in_string_extents().

Why does such a heavy-weight routine need to be called three times for
each insertion?

Another duplication is in the pair of routines adjust_markers() and
adjust_extents() (called from the gap movement routines).
adjust_extents() calls do_marker_adjustment under a condition I don't
understand yet.

Here is another benchmark.

(defconst bench-mark-function-alist 
  '(
 ...
    (bench-mark-14 . "Test for R-O status")
 ...

(defun bench-mark-14 ()
  (save-excursion
    (set-buffer (get-buffer-create "*tmp*"))
    (erase-buffer)
    (let ((a 1000000))
      (while (> a 0)
	(barf-if-buffer-read-only)
	(setq a (1- a))))
    (kill-buffer "*tmp*")))


(bench 10)

Emacs 19.34:
bench-mark-14  10          56.728084999  5.6728084999   <= Test for R-O status

Emacs 19.15-b5:
bench-mark-14  10          86.907739999  8.6907739999   <= Test for R-O status


I thought extents were supposed to be fast?
-- 
steve@miranova.com baur
Unsolicited commercial e-mail will be billed at $250/message.
"That Bill Clinton.  He probably doesn't know how to log on to the
Internet."  -- Rush Limbaugh, noted Computer Expert

