On Thu, Aug 7, 2008 at 7:21 AM, Christoph Boget <christoph.boget@xxxxxxxxx>wrote: > I knew that there would be some overhead when working with objects vs > working with arrays, but I didn't expect this much. Is there some > optimization that I could do to improve the performance any? While > the script below is just a benchmark test script, it approximates > functionality that I'm going to need to implement. Ultimately, I need > to iterate through a large amount of data and am wondering if perhaps > I should encapsulate the data in objects (which closer represents the > underlying data) i lost you on this one.. organizing data w/ arrays and objects should be essentially the same thing. they both support name value pairs and nesting. since data doesnt inherently have operations, i dont see how organization could be any better w/ objects (just my opinion). > or if I should encapsulate it in arrays. Based on > what I'm seeing in this benchmark script, it seems like it should be > the latter... so when i tend to design a project, if i plan on using oop, i use oop. some systems might offer options to get back 'only' an array at certain points, as an optimization. however, if i see data and methods realating to one another, i tend to bundle them up in a class. of course you can just use plain old methods and arrays, but then thats a different style of programming. if its any slower, in my mind, i really dont care. i save time and sanity by using the oop techniques i know at design / impl time. soo, maybe more ram and cpu and objects on this one :D -nathan