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