Scott, Im not certain how your DirectoryEntry wrapper class UserDirectoryObject is implemented but I would expect that it reads one property at a time from the DirectoryEntry object or loads them all or each one on demand from the UserDirectoryObject object. I would expect that your performance is due to reading from AD directly in your loop (lastName reading sn and firstName reading givenName) vs. adding the rows since you can add at least 100,000 rows to a datatable in < 5 seconds on today's average PC hardware.
Chad On Tue, 6 Jan 2004 14:08:15 -0500, Scott A. Lawrence <[EMAIL PROTECTED]> wrote: >I'm writing a user profile tool that manipulates information in an LDAP >server. I'm using an abstraction layer that talks directly to the server >(written by another developer). The function of the abstraction layer that >returns a list of all the users in LDAP returns an ArrayList. For easier >filtering and sorting of this data, I build a DataTable in code, returning >its default view so it can be bound to a DataGrid. > >The app currently takes between 15-20 seconds to load approximately 800 >users from the LDAP source into memory, cache the user information, and >display the page (DataGrid displays 20 users per page). The vast majority >of that time (13-18 seconds) is consumed by the foreach loop that puts each >ArrayList element into the > >The code in question looks like the following: > >ArrayList userList = theDirectory.getUsers(); > >if (userList != null) >{ > foreach (UserDirectoryObject user in userList) > { > DataRow drUser = tblUsers.NewRow(); > drUser["lastName"] = user.lastName; > drUser["firstName"] = user.firstName; > /* etc */ > tblUsers.Rows.Add(drUser); > } >} > >tblUsers.DefaultView.Sort = "lastName"; >return tblUsers.DefaultView > > >Any suggestions about how to increase the speed of this would be greatly >appreciated. > >Thanks! > >=================================== >This list is hosted by DevelopMentorŪ http://www.develop.com >Some .NET courses you may be interested in: > >NEW! Guerrilla ASP.NET, 26 Jan 2004, in Los Angeles >http://www.develop.com/courses/gaspdotnetls > >View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorŪ http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 26 Jan 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com