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

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

Re: make-hash-table :size


From: Oliver Scholz
Subject: Re: make-hash-table :size
Date: Sun, 29 Aug 2004 23:10:24 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (windows-nt)

Pascal Bourguignon <spam@mouse-potato.com> writes:

> Oliver Scholz <alkibiades@gmx.de> writes:

[hash tables vs. alist for about a dozen elements.]
]
>> On my Emacs 21.3 on a 1.5 GHtz Athlon M-x test-run gives:
>> 
>> Function Name      Call Count  Elapsed Time  Average Time
>> =================  ==========  ============  ============
>> test-hash-access   10000       0.09          9e-006
>> test-alist-access  10000       0.04          4e-006
>
> Actually, I wrote a more complete benchmark before delivering my conclusion:

The completeness wouldn't explain the differences. I wouldn't trust
the actual times provided by the Emacs Lisp profiler, but the relative
times should be similar in both your benchmark and mine. Obviously, I
do not doubt your results, but I'd say that the differences request
explanation; and I am curious about their reason.

Actually I couldn't get your code to run:

> --------------------(hash-table.el)--------------------------------------
>
> ;; Let's include some CL stuff:
> (require 'cl)
>
> (defconstant internal-time-units-per-second 1000000
[...]

AFAICS `defconstant' doesn't exist, not even in cl.el.  But more
importantly:

[...]
> (defun alist-fetch (table test key)  (assoc key table :test test))

This `assoc' is not an Emacs function. There does exist an cl.el
function with such a parameter specification, but this one is called
`assoc*'.

I assume that you use some extended CL compatibility package other
than the one that comes with stock Emacs?  If that one overwrites
Emacs' `assoc' (which is implemented in C) with a function implemented
in Lisp, that could explain the profiling differences.


    Oliver
-- 
13 Fructidor an 212 de la Révolution
Liberté, Egalité, Fraternité!


reply via email to

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