Page 1 of 1

"OVER 9000!" Object IDs

Posted: Mon Feb 10, 2014 4:28 am
by nlexa
I have a stack that
1. Creates many objects - to populate a screen with controls
2. Deletes them - to clear the screen for repopulation.
For all objects, the ID is guaranteed to be unique within a stack. IDs are not reused if the object is deleted.
At the moment my objects have IDs of 91000.
I'm concerned that over time the IDs will get larger and larger because the IDs are not reused.
Will this lead to any appreciable loss in speed of the program?

Lets say that my program runs all day for a year. It refreshes the screen once a minute deleting the old objects and creating 200 new objects.
200 * 60 * 24 * 365 = 105,120,000

I guess it would take 50 year of running continuously for the ID numbers to be so great that they take up more than 1 byte on a 32bit computer.

Re: "OVER 9000!" Object IDs

Posted: Mon Feb 10, 2014 4:33 am
by FourthWorld
IDs in LiveCode are indeed 32-bit values, so the upper end of the range is just under 4.3 billion - should take a very long time to reach that.

If one had a serious concern, rather than creating and disposing of objects it would save IDs (and possibly be more effecient in other areas) to simply hide and show controls as needed, reusing existing ones as you go.

Re: "OVER 9000!" Object IDs

Posted: Mon Feb 10, 2014 6:26 am
by dunbarx
Hi.

I am with Richard on this.

If you are currently creating controls, it is likely you are also setting certain properties at creation time, such as, say, name, rect and loc. If you had a bunch of these ready-made, you might similarly set those properties (and perhaps have to manage fewer of them), and just hide and show as many as you need at any particular time. I bet this will require less management than you are supporting now.

Craig Newman