From: Daniel Berlin <dberlin@dberlin.org>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: David Carlton <carlton@math.stanford.edu>,
Jim Blandy <jimb@redhat.com>, <gdb@sources.redhat.com>
Subject: Re: suggestion for dictionary representation
Date: Mon, 23 Sep 2002 21:28:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.44.0209240006070.4266-100000@dberlin.org> (raw)
In-Reply-To: <20020924012618.GA11065@nevyn.them.org>
On Mon, 23 Sep 2002, Daniel Jacobowitz wrote:
> On Mon, Sep 23, 2002 at 08:34:50PM -0400, Daniel Berlin wrote:
> > >I'm also curious about how it would affect the speed of reading in
> > >symbols. Right now, that should be O(n), where n is the number of
> > >global symbols, right?
> >
> > > If we used expandable hash tables, then I
> > >think it would be amortized O(n) and with the constant factor larger.
> >
> > Nope.
> > Our string hash function is O(N) right now (as are most). Hash tables
> > are only O(N) when the hash function is O(1).
> >
> > Now, if you have it only hash the first x characters, you can make your
> > hash table O(N) again, with the x as the constant. Of course, if only
> > hashing the first x characters causes tons of hash conflicts, it's not
> > going to make your hash table very fast.
>
> Wait a second... aren't you switching N's on us?
Yes, but this just makes it O(MN), where M is your string hash time, N is
your number of global symbols.
Although M is not likely to approach N, it could happen on *very* long
mangled names (i've seen some > 500 characters, in applications with
around that many *global* symbols), or easily if you index on demangled
names.
> is the number of
> global symbols. We're talking about the total time of adding all
> symbols to the table.
I'm quite aware.
> Hashing a string is "effectively" constant time,
It's not.
> because all string lengths are "small".
Bullshit.
libstdc++, fer instance, has an average symbol length of 42 (mangled).
Longest is 131 characters.
Demangled, the average is 86.
Longest is 1116.
>
> > >(But, I think, not larger in a way that would make a difference.) I'm
> > >curious about how often the "amortized" bit would lead to strange
> > >hiccups, but I don't think that's a big deal.
> > >
> > >But for skip lists, wouldn't it be something like O(n log n)? If so,
> > >that's an issue we have to consider.
> >
> > Put it in perspective.
> > for 1 billion symbols, n is 29.89.
> > for 1 million symbols, n is 19.93.
>
> You mean "log n", of course.
yup.
>
>
next prev parent reply other threads:[~2002-09-24 4:28 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-22 19:59 Jim Blandy
2002-09-22 20:11 ` Daniel Jacobowitz
2002-09-23 10:38 ` David Carlton
2002-09-23 17:34 ` Daniel Berlin
2002-09-23 18:39 ` Daniel Jacobowitz
2002-09-23 21:28 ` Daniel Berlin [this message]
2002-09-23 21:38 ` Eli Zaretskii
2002-09-23 21:44 ` Daniel Berlin
2002-09-23 21:47 ` Eli Zaretskii
2002-09-23 21:54 ` Daniel Berlin
2002-09-24 9:33 ` David Carlton
2002-09-24 10:42 ` Daniel Berlin
2002-09-24 10:53 ` David Carlton
2002-09-24 20:01 ` Jim Blandy
2002-09-24 20:50 ` Daniel Berlin
2002-09-23 18:28 ` Daniel Jacobowitz
2002-09-24 3:51 ` Paul N. Hilfinger
2002-09-24 19:52 ` Jim Blandy
2002-09-24 20:37 ` Elena Zannoni
2002-09-24 20:53 ` Daniel Berlin
2002-09-23 23:50 Jim Blandy
2002-09-24 6:19 ` Daniel Berlin
2002-09-24 7:06 ` Daniel Jacobowitz
2002-09-24 21:01 ` Jim Blandy
2002-09-25 5:54 ` Daniel Jacobowitz
2002-09-27 11:23 ` Jim Blandy
2002-09-27 11:28 ` Daniel Jacobowitz
2002-09-24 9:49 ` David Carlton
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=Pine.LNX.4.44.0209240006070.4266-100000@dberlin.org \
--to=dberlin@dberlin.org \
--cc=carlton@math.stanford.edu \
--cc=drow@mvista.com \
--cc=gdb@sources.redhat.com \
--cc=jimb@redhat.com \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox