• Dear Cerberus X User!

    As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.

    Important: If you accept the amended Terms and Rules, you agree to the transfer of your user data to the future forum owner!

    Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.

    Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!

    Accepting ensures:

    - Continued access to your account with a short break for the actual transfer.

    - Retention of your data under the same terms.

    Without consent:

    - You don't have further access to your forum user account.

    - Your account and personal data will be deleted after April 5, 2024.

    - Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.

    We hope to keep you in our community and see you on the forum soon!

    All the best

    Your Cerberus X Team

Datatype Q.

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,414
This one is for everyone how is good at datatypes of CX.

Right now I'm at the point that I'm gonna need to scale up the data-usage quiet a bit.

Basically I currently use a simple array, which is as simple as it gets of course. It does a fine job when I do random acccess, which is what I need.

Code:
Field worldmap:Int[512*512] ' 12 screens world

' But now I'm gonna need to make it grow quiet a bit, and it might even get non-practical in some scenarios:

Field worldmap:Int[2048*2048] ' 50 screens world

Is it still a good idea to keep it as a simple array or should I use other datatypes?

The usage is currently a plain 1D that simulates to be a 2D array and the access will happen with reads and writes in strides of a few sequential screens at a time, vertically or horisontally. I just use simple multiplication or shifting atm. I'm worried about that garbage collection or caching / loading or other random delays when you jump around. Should I use something different? Any ideas?
 
2048x2048 of course becomes 16MB for 32-bit int, and 32MB for 64-bit int.
and I'm willing to waste more space for speed.

EDIT
I use a naive approach now :

1) PICK ANY STARTINGPOINT
2) LOOPHERE : READ e.g. 128 CONSECUTIVE VALUES
3) ADD STRIDE e.g. 2048 AND LOOP ABOVE, UNTIL HAPPY
4) DONE!

Of course this would never work with "infinite" data.
 
Last edited:
I'm worried about that garbage collection or caching / loading or other random delays when you jump around.
Normal arrays should have no performance issues for basic access. The issues arise when you resize arrays.

2048x2048 of course becomes 16MB for 32-bit int, and 32MB for 64-bit int.
Wrong. The size of an it will be determined by the compiler and in some cases the platform. In general an integer is defined as a signed four byte 32 bit value.
 
In general an integer is defined as a signed four byte 32 bit value.
That was what I meant. I just counted the bits, sorry about the datatype missmatch.

I asked a Autodesk programmer and he said It will work just fine but I have my doubts on some phones. I wish I had more devices to try it on.
 
Thanks for your response, much appreciated. I'm not gonna resize, have a big plan to reuse everything constantly.
 
Back
Top Bottom