Pages: 1
  Print  
Author Topic: Var 4  (Read 10372 times)
Offline (Male) Josh @ Dreamland
Posted on: June 19, 2010, 07:12:35 am

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
Questions on which to pick and why have boiled down to the need to separate var into individual sources, each implementing a behavior. Var 4 will apparently implement several options.

The first of these is in how arrays are handled:
- GM uses a Map for everything, as some of you know. I guess I could make that an option.
- ENIGMA R3 uses a simple dynamic array. It checks for size, then dereferences O(1).
- Lua uses both. It would implement no additional overhead from R3, but would add some in computing whether it should use the map for large indexes.

The second of these is in how variants store memory.
- GM's method cannot be determined simply through experimentation. Presumably, since it is interpreted, Mark keeps close track of type (an extra check among a map lookup is nothing).
- ENIGMA R3 kept variant next to double for max speed, but high memory usage.
- I am capable of constructing and destroying string on the site, at the cost of an additional check per = operation (and of course, constructor and destructor call). This will reduce memory usage, but slightly(?) lower speed as well.

I will spend today trying to implement them (among other things).
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) Game_boy
Reply #1 Posted on: June 19, 2010, 09:26:08 am
Member
Joined: Apr 2008
Posts: 228

View Profile
This will be the most uninformed comment yet, but it looks to me like most computers have more than enough RAM and are generally CPU-bound out of the two (and GPU-bound if you include graphics due to the widespread use of Intel integrated rubbish). Especially on Dell and HP bought machines which could be considered the 'masses' compared to people who know how a computer works.

So I'd favour speed over memory conservation?
Logged
Offline (Male) Josh @ Dreamland
Reply #2 Posted on: June 19, 2010, 02:04:43 pm

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
That's what I was thinking. In fact, the new instance system also uses quite a bit more memory than the old. We're talking nearly half a megabyte for a game with 1,000 instances at 10 events apiece. But it introduces a beautiful mechanism for the instance functions, and even with() and the like.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) Josh @ Dreamland
Reply #3 Posted on: June 20, 2010, 12:52:48 am

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
Copy on write will be implemented as well. Basically, scripts can return arrays via this new magic. At no efficiency cost. However, there is a detriment on setting equivalent a var and a large array. Because of that, I believe I will be making as many globals as possible use scalar types. (Or variant if I have to).

Variant will now be a type at the user's disposal. Not boost::variant, just R3's enigma::variant.

Also, string() is handled more beautifully, such that string str; will still get you a string, but string(somevar) will work as well. This is possible via a simple macro, #define string(x) toString(x). (Luckily, string alone will not error nor attempt to unfold the macro function.)
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) The 11th plague of Egypt
Reply #4 Posted on: June 21, 2010, 11:57:49 am
Member
Joined: Dec 2009
Posts: 274

View Profile
I had to read your first post 3 times to understand it. :eng99:

Good to see you are happy to share your thoughts. (Y)
Logged
Offline (Male) Josh @ Dreamland
Reply #5 Posted on: June 21, 2010, 12:00:07 pm

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
Heh.
Also, copy-on-write will introduce a branch of overhead. I'm hoping it's negligible.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) The 11th plague of Egypt
Reply #6 Posted on: June 22, 2010, 06:00:39 am
Member
Joined: Dec 2009
Posts: 274

View Profile
Seems like we'll have some tests to do :)
Logged
Pages: 1
  Print