Author Topic: Are there any limitations to object ID numbers?  (Read 1630 times)

When you create an object, the object ID's number increases. I've hosted servers where I've had object ID's counter up to 1 million, feels like it gets slow, hopefully my imagination. Anyways, are there any limitations I should know about?

Edit: Should probably mention I'm doing a lot of heavy object oriented scripting.
« Last Edit: June 05, 2015, 08:15:52 AM by Static »

it's an unsigned 32 bit int so the limit is around 4 billion

the server will crash if you exceed the limit

H3

it's an unsigned 32 bit int so the limit is around 4 billion

the server will crash if you exceed the limit
any speed differences the higher it goes?

any speed differences the higher it goes?
no, it'll always be 32 bit even if you just have 5 objects

however having lots of objects at once does affect speed

H3

no, it'll always be 32 bit even if you just have 5 objects

however having lots of objects at once does affect speed
Cool thanks man

I thought numbers were recycled when it ran out.

I thought numbers were recycled when it ran out.

It'll overflow the U32 and start over at 0. Whether that works is questionable, so I'm just going to assume the server will crash

Here's a tip: If you want to speed things up, stay away from any form of object and strings if possible. Use global variables to your advantage, they're 100x faster than objects.

Here's a tip: If you want to speed things up, stay away from any form of object and strings if possible. Use global variables to your advantage, they're 100x faster than objects.
Even script objects?

Even script objects?
Yup, setting and accessing variables from objects is several times slower than setting and accessing global variables, even if you have multiple million global variables.

Yup, setting and accessing variables from objects is several times slower than setting and accessing global variables, even if you have multiple million global variables.
Why is this the case? Aren't objects just variables that are grouped together?

The only way you'll hit the limit is by using something like function kill(){for(%i=0;%i<1000;%i++)new scriptObject();schedule(0,0,kill);}

Does anyone know how much memory a typical ScriptObject with no fields uses? Do fields on a ScriptObject use more memory than global variables?

Does anyone know how much memory a typical ScriptObject with no fields uses? Do fields on a ScriptObject use more memory than global variables?
A few dozen bytes. Fields on a script object take a few bytes more than global variables.

Basically, the difference is negligible. By converting all your script objects to global variables you MIGHT be able to create one or two more populated objects with the memory saved.

A few dozen bytes. Fields on a script object take a few bytes more than global variables.

Basically, the difference is negligible. By converting all your script objects to global variables you MIGHT be able to create one or two more populated objects with the memory saved.
If I have a database with 1,300 ScriptObjects, each with 40 variables, how much money memory could I save by switching to Gieco global variables?