You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by rb...@covalent.net on 2001/01/20 17:19:01 UTC

Re: cvs commit: apr/tables apr_tables.c

On 20 Jan 2001 gstein@apache.org wrote:

> gstein      01/01/20 03:34:32
> 
>   Modified:    include  apr_tables.h
>                tables   apr_tables.c
>   Log:
>   yes, you *will* use a hash instead. any questions can be directed to Bubba.

?????  A hash and a table are two different things and both are
useful.  How do I insert data into a hash and iterate over it in the exact
same order?

I would really have appreciated if this change had been discussed at some
point before an entire type was just removed.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apr/tables apr_tables.c

Posted by "Roy T. Fielding" <fi...@ebuilt.com>.
Greg did the right thing -- binary tables were obsoleted by the
hash implemenation, and they need to be removed now so that they
don't become yet another feature bloat that people insist on
having around forever for backwards compatibility.

Assuming that the table is ordered is forbidden by the table API
and has been since Robert Thau created it, explicitly because
the intention was to replace the implementation with a table.
If you want an ordered table, then use the array types directly.

Now is the time to weed out what isn't being used.

....Roy

Re: cvs commit: apr/tables apr_tables.c

Posted by Greg Stein <gs...@lyra.org>.
On Sat, Jan 20, 2001 at 04:03:05PM -0800, rbb@covalent.net wrote:
>...
> Sure they do.  Take a look at apr_table_add, that just adds another
> element at the end of the table, and then I can call apr_table_do, and
> iterate over them, or I can get the elements directly and iterate over
> them.

The implementation allows for it, sure. But the table was intended to be a
hash. And hash table semantics don't provide for ordering.

> > Regardless: nobody uses binary tables, and I don't know that anybody
> > plans to anywhere in the code. Hash tables are a much better than
> > binary tables. Tables (normal or binary) are linear-time for lookup,
> > even though they export a key-based style like a hash table.
> > Why do we need binary tables?
> 
> Nobody uses them because they were just added at the beginning of 2.0, and
> nobody has gone through the code yet to see where they are useful.

They were added prior to hash tables. I bet those "useful" spots would be
more useful as a hash table :-)

I see no conceivable need for the binary table, so there is no need to
multiple-path our code with text and binary tables and hashes. Drop the
bloat, drop the maintenance, etc.

>...
> As far as why do we need them, with the hash implementation, why do we
> need text tables anymore?  They are the same basic thing, and the hash
> implementation can provide for both text and binary data, so couldn't
> everything be implemented as a hash table?

Absolutely. I would toss the text tables, too... if I could :-) But that
data type is just too ingrained and widespread. Nobody was touching binary
tables, so it is easy to toss them and refer users to hash tables instead.

> Regardless, since people in the group have wanted binary tables for over
> two years,

Their needs are met by the new hash table that Tony did.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: cvs commit: apr/tables apr_tables.c

Posted by rb...@covalent.net.
> > Another feature that remains useful, is to be able to iterate over the
> > array, and know that you are getting data out in the same order that it
> > was originally added.  That feature does not exist with hash tables.
> 
> Tables' API/semantics don't provide for that. Tables were intended to be a
> hash, but the implementation never got there.

Sure they do.  Take a look at apr_table_add, that just adds another
element at the end of the table, and then I can call apr_table_do, and
iterate over them, or I can get the elements directly and iterate over
them.

> Regardless: nobody uses binary tables, and I don't know that anybody
> plans to anywhere in the code. Hash tables are a much better than
> binary tables. Tables (normal or binary) are linear-time for lookup,
> even though they export a key-based style like a hash table.
> Why do we need binary tables?

Nobody uses them because they were just added at the beginning of 2.0, and
nobody has gone through the code yet to see where they are useful.  I seem
to recall that people were talking about making the request_rec->notes
table a binary table so that binary data could be passed between
modules.  Beyond that I would need to actually investigate the code a bit
more.

As far as why do we need them, with the hash implementation, why do we
need text tables anymore?  They are the same basic thing, and the hash
implementation can provide for both text and binary data, so couldn't
everything be implemented as a hash table?

Regardless, since people in the group have wanted binary tables for over
two years, it would have been very nice if this had been discussed before
they were simply removed.  I would go search the archives for all the
times Lars and Dirk mentioned needing binary tables, and where they wanted
them, but searching our archives isn't easy right now, and I am in the
middle of other work.  I'll try to find it later tonight.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apr/tables apr_tables.c

Posted by Greg Stein <gs...@lyra.org>.
On Sat, Jan 20, 2001 at 03:39:26PM -0800, rbb@covalent.net wrote:
> On Sat, 20 Jan 2001, Greg Stein wrote:
> > It wasn't clear from my checkin message :-) ... I just removed the "btable"
> > option. Binary tables are not useful, given our hash table implementation.
> > 
> > What features of a table are you looking for, which hash tables do not
> > provide?
>...
> As far as options for the btable that aren't in the hash, how about size
> of the table.  A hash table starts at 15 entries, and doubles each time it
> is expanded.  A table is created with a size specified by the person
> writing the code, and it grows by one each time.

Tables double in size since they are built on top of arrays. See
apr_push_array().

Regarding the initial size hint: we can do that.

> Another feature that remains useful, is to be able to iterate over the
> array, and know that you are getting data out in the same order that it
> was originally added.  That feature does not exist with hash tables.

Tables' API/semantics don't provide for that. Tables were intended to be a
hash, but the implementation never got there.


Regardless: nobody uses binary tables, and I don't know that anybody plans
to anywhere in the code. Hash tables are a much better than binary tables.
Tables (normal or binary) are linear-time for lookup, even though they
export a key-based style like a hash table.

Why do we need binary tables?

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: cvs commit: apr/tables apr_tables.c

Posted by rb...@covalent.net.
On Sat, 20 Jan 2001, Greg Stein wrote:

> It wasn't clear from my checkin message :-) ... I just removed the "btable"
> option. Binary tables are not useful, given our hash table implementation.
> 
> What features of a table are you looking for, which hash tables do not
> provide?

I knew exactly what you did, and I disagree with it.  People have been
talking about the binary table implementation for at least two years, and
as soon as we got it, you just removed it without asking.

As far as options for the btable that aren't in the hash, how about size
of the table.  A hash table starts at 15 entries, and doubles each time it
is expanded.  A table is created with a size specified by the person
writing the code, and it grows by one each time.

Another feature that remains useful, is to be able to iterate over the
array, and know that you are getting data out in the same order that it
was originally added.  That feature does not exist with hash tables.

I am still -0.5 for removing the binary table implementation, and I am
leaning towards -1.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apr/tables apr_tables.c

Posted by Greg Stein <gs...@lyra.org>.
It wasn't clear from my checkin message :-) ... I just removed the "btable"
option. Binary tables are not useful, given our hash table implementation.

What features of a table are you looking for, which hash tables do not
provide?

Cheers,
-g

On Sat, Jan 20, 2001 at 09:15:30AM -0800, rbb@covalent.net wrote:
> 
> > > >   yes, you *will* use a hash instead. any questions can be directed to Bubba.
> > > 
> > > ?????  A hash and a table are two different things and both are
> > > useful.  How do I insert data into a hash and iterate over it in the exact
> > > same order?
> > 
> > apr_table_t is a list, but we don't insert.  Hashed tables can't be iterated.
> > There needs to be something in between for some classes of data.
> 
> Hmmm...  What do you mean we don't insert into a table?  There is an
> apr_hash_next function to allow us to iterate over the hash table, but of
> course the data is now out of order.
> 
> > > I would really have appreciated if this change had been discussed at some
> > > point before an entire type was just removed.
> > 
> > Ack, although we aren't using it right -now-, I'm -0.5 on this change
> 
> -0.5 from me too.  We may not use it, but this API has been being talked
> about since I joined this list over two years ago.  By removing it I
> believe we have taken a step backwards.  :-(
> 
> Ryan
> 
> _______________________________________________________________________________
> Ryan Bloom                        	rbb@apache.org
> 406 29th St.
> San Francisco, CA 94131
> -------------------------------------------------------------------------------

-- 
Greg Stein, http://www.lyra.org/

Re: cvs commit: apr/tables apr_tables.c

Posted by rb...@covalent.net.
> > >   yes, you *will* use a hash instead. any questions can be directed to Bubba.
> > 
> > ?????  A hash and a table are two different things and both are
> > useful.  How do I insert data into a hash and iterate over it in the exact
> > same order?
> 
> apr_table_t is a list, but we don't insert.  Hashed tables can't be iterated.
> There needs to be something in between for some classes of data.

Hmmm...  What do you mean we don't insert into a table?  There is an
apr_hash_next function to allow us to iterate over the hash table, but of
course the data is now out of order.

> > I would really have appreciated if this change had been discussed at some
> > point before an entire type was just removed.
> 
> Ack, although we aren't using it right -now-, I'm -0.5 on this change

-0.5 from me too.  We may not use it, but this API has been being talked
about since I joined this list over two years ago.  By removing it I
believe we have taken a step backwards.  :-(

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apr/tables apr_tables.c

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
From: <rb...@covalent.net>
Sent: Saturday, January 20, 2001 10:19 AM


> > gstein      01/01/20 03:34:32
> > 
> >   Modified:    include  apr_tables.h
> >                tables   apr_tables.c
> >   Log:
> >   yes, you *will* use a hash instead. any questions can be directed to Bubba.
> 
> ?????  A hash and a table are two different things and both are
> useful.  How do I insert data into a hash and iterate over it in the exact
> same order?

apr_table_t is a list, but we don't insert.  Hashed tables can't be iterated.
There needs to be something in between for some classes of data.

> I would really have appreciated if this change had been discussed at some
> point before an entire type was just removed.

Ack, although we aren't using it right -now-, I'm -0.5 on this change