On 26/05/16 22:36, Rowan Collins wrote: >> So every time I update the current tree because the client has selected >> a different initial root I have to destroy perhaps 30 person objects and >> rebuild the whole lot again from scratch? > > In a word, yes: if you have a different set of data, use a different set > of objects to hold it. > > Objects are not memory slots to be re-filled, they represent a specific > instance of a thing. Creating and destroying 30 objects on a modern > system is the work of nanoseconds, and not something to be avoided at > all costs.
There we will have to disagree! And much of the reworking of the core operations of PHP7 was to remove the unnecessary transfer of data from one area of memory to another to get the speed up. It is also in my book why PDO has not solved the problem of handling data properly either. Now it may be that completely stand alone PHP applications using nothing else do require a different mindset, but once one adds using a database as the persistent data layer some things are better done in other ways. My example of genealogical data covers the vast majority of what is needed to create any web based application and the problems that current thinking in how PHP should evolve are creating. I can run PHP to individually access every member of the family tree with individual database reads ... or I can produce a CTE query that returns all of the data in one hit. The results of that read are an already populated associative array of data. In an ideal world every element would be a fully typed and constrained variable and in early PHP5 days the recommendations were to use hashes of variables rather than individual 'var' properties as it made management more 'OO' like. Now things seem to have swung full circle and hashes are out and we need individual properties/variables again but of this new 'much more robust' style? And strict typing is supposed to be better. I get that 'var' needed to evolve to add accessibility and would ideally benefit from a level of typing, but where ever that var is used should work exactly the same way and one should be able to simply use a $[id][date_of_birth] DateTime element as if it was simply a constrained scalar variable. My major hate with genealogical data is having to make sure that the dates and times are the same. Translating European material which has been 'reformatted' to use American date style IS something to be avoided at all costs and can add orders of magnitude to processing time while storing the results as a simple integer eliminates all of that processing. But even then one can't be sure if one is using the same 'type' of second :( Having accessed the data which naturally includes many null elements is it REALLY more efficient then to create new copies of all of that material? -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php