I’d heard other people in the community mention that, while ColdFusion 8 was faster, object creation was notoriously slow. I never understood what they were talking about as I was creating up to 3000 DTO objects to pass to Flex and was seeing times between 300ms-2000ms for the entire process.

Well, today I discovered what they were talking about. While architecting a new piece of functionality in one of our apps, I needed to create a DTO that has 57 properties. Also, the data set for each user averages 1000+ rows (and, thus, 1000+ DTOs created). The execution times startled me at first.

Here are my notes.

With 57 Attributes
==============================================
	300 rows
	==============================================
	4438ms for converting to DTOs (100% slower)
	2216ms for no conversion

	1070 rows
	==============================================
	10485ms for converting to DTOs (198% slower)
	3516ms for no conversion

With 20 attributes
==============================================
	300 rows
	==============================================
	2250ms for converting to DTOs (20% slower)
	1875ms for no conversion

	1070 rows
	==============================================
	5735ms for converting to DTOs (144% slower)
	2344ms for no conversion

I always knew that the number of objects created would always increase time, but I never realized that the size of the object would have such an impact. In the past, I’ve always dealt with DTOs that had less than 10 properties.

Now we have to make a hard decision on when, or perhaps how, to implement DTOs when using ColdFusion to send data to our Flex UIs. We either have to come up with a way to do pagination in our requests (only request 200 rows at a time for large objects), or abandon DTOs altogether and work with the native ArrayCollection type passed back for ColdFusion queries. I’d hate to lose my types data objects in Flex, but if the impact is making a user wait for 10 or 20 seconds for his/her data to load, we’ll have to find an alternative.