[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: JLDAP Bug n fixes (ITS#1512)



Sorry Kurt.  I didn't see your address in the message that Steve sent to me.
I have replied to Steve with the following:

>I have reviewed your changes for com.novell.ldap.LDAPAttribute.  I
> like much of what I see.  You have done some good work.
> It has been a long while since we looked at this code, and it
> is obvious it needed looking at.
I found myself doing this (looking at the code) out of curiosity to
understand what is going on when I use the API because I was/am new to LDAP.
There are some other things that I saw that could use a little tweaking but
I wasn't sure how I should approach making changes that don't fix any bugs
(keep it to myself or give it back to the community).

The API is not too large but its big enough to be really time consuming to
go through all of it and understand how everything fits together.
Eventually I might get there but that depends on my work load and other
responsibilities.  What would be great is a UML class diagram of the API.
You wouldn't happen to have one would you?  Anyway, let me know what the
plans are for updating the code.  I'm willing to contribute if I can.


>The existing code stores attribute values in an ArrayList.  The
> code you supplied puts the values in an Object[] and must
> allocate a new Object[] each time an attribute is added
> or removed.  This seems much more expensive than simply
> adding a value to a list.   We were trying to avoid object
> creation a much as possible. What problem were you trying
> to solve when you made that change?

The decision to use an Object array instead of an ArrayList was based upon
the following assumption (supported by my observation of data in directories
that I've seen): The majority of attributes in a directory has only one
value (e.g., name, address, etc).  If you subscribe to that idea then it
makes sense to use a fixed array.  You get speed benefits because there is
no method call overhead and you have reduce your memory consumption because
a java.util.ArrayList requires almost 2x the amount of memory compared to a
static array of equal size.  Finally, in the event that there is an
Attribute w/ multiple values the method I've chosen will perform as well (or
even better in some cases) as a java.util.ArrayList for small data-sets.
Fortunately, most multi-valued attributes have relatively small multiple
values.  ArrayList are great tools and a very good solution to a large
domain of problems but in my opinion a directory is a special case and I
think we should take advantage of this where possible to maximize
performance.

Again, if you plan on incorporating my changes I would like to make a few
minor adjustments before you do.  Thanx.


Dane Foster
http://www.equitytg.com
954.360.9800
----- Original Message -----
From: "Kurt D. Zeilenga" <Kurt@OpenLDAP.org>
To: <vtag@novell.com>
Cc: <openldap-its@OpenLDAP.org>; <dfoster@equitytg.com>
Sent: Monday, January 07, 2002 4:33 PM
Subject: Re: JLDAP Bug n fixes (ITS#1512)


> At 01:01 PM 2002-01-07, vtag@novell.com wrote:
> >It certainly doesn't make sense to do something like
> >  LDAPAttribute("name", new String[]  {"a", "b", null, "c"});
> >This case should probably throw an exception.
>
> I would have to agree.  But,
>
> LDAPAttribute("mail", new String[]  {"a", "b", "", "c"});
>
> would be valid (IA5 strings allow empty values), null != empty.
>
>
>