• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Which one takes up more memory: 4 reals or 1 rect?

Status
Not open for further replies.

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
Hello there.
I've been tinkering with structs for the past few months and have ran across a doubt: which one will take more memory: 4 reals or 1 rect? The reals are the rect's minX,minY,maxX,maxY.
JASS:
    real minx
    real miny
    real maxx
    real maxy
Using a rect also makes the create function shorter, but I will only create a fix number of these structs and they'll last for the entire game.


Thank you in advance!
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Rect also includes the creation and handling of the region behind it. I think that working with the 4 reals is faster.
 
  • Like
Reactions: Rui

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
The 4 reals are probably more memory efficient because they avoid all the extra object maintenence complexity which a rect needs. The reals might map directly to positions in a hash table meaning no extra memory usage unless they cause the hashtable to grow.
 
Status
Not open for further replies.
Top