all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dai Yuwen <daiyuwen@sdf.lonestar.org>
Subject: Re: performance of converting alist to hash table
Date: Tue, 18 May 2004 11:50:30 +0000	[thread overview]
Message-ID: <20040518115030.GA21952@SDF.LONESTAR.ORG> (raw)
In-Reply-To: <20040517233743.GA11854@fencepost>

On Mon, May 17, 2004 at 07:37:43PM -0400, Miles Bader wrote:
> On Mon, May 17, 2004 at 01:43:41PM -0400, Ted Zlatanov wrote:
> > Maybe the equality test you are using is too slow?
> 
> I think that's a good point -- specifying _any_ non-standard :test function
> (that is, anything except eq/eql/equal) probably slows down hashing quite a
> bit.
> 
I use equal as the test function:
(setq ta (make-hash-table :test 'equal :size 7000))

But I forgot to mention: the key of hash is a Chinese GB2312 string. Does this slow down hashing?

I decide to give up using hash. After all alist behaves like hash. All I need is a function like gethash:
(defun get-value (key)
   (cadr (assoc key alist)))

I profiled get-value and gethash, the result is acceptable, though get-value is slower.

Best regards,
Dai Yuwen

  reply	other threads:[~2004-05-18 11:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-16  9:55 performance of converting alist to hash table Dai Yuwen
2004-05-16 10:13 ` Thien-Thi Nguyen
2004-05-16 12:35   ` Dai Yuwen
2004-05-16 11:18 ` Eli Zaretskii
2004-05-16 12:14   ` Dai Yuwen
2004-05-16 14:02     ` Andreas Schwab
2004-05-16 15:51       ` Adrian Aichner
2004-05-17  1:18       ` Dai Yuwen
2004-05-17 17:43 ` Ted Zlatanov
2004-05-17 23:37   ` Miles Bader
2004-05-18 11:50     ` Dai Yuwen [this message]
2004-05-18 13:42       ` Stefan Monnier
2004-05-19 11:59         ` Dai Yuwen
2004-05-19 23:27           ` Kenichi Handa
2004-05-26 13:29             ` Dai Yuwen
2004-05-26 23:21               ` Kenichi Handa
2004-05-18 12:23 ` David Kastrup
2004-05-19 12:02   ` Dai Yuwen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040518115030.GA21952@SDF.LONESTAR.ORG \
    --to=daiyuwen@sdf.lonestar.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.