Pages: « 1 2 3 »
  Print  
Author Topic: Rejoice  (Read 6080 times)
Offline (Unknown gender) score_under
Reply #15 Posted on: February 20, 2010, 06:13:26 PM

Member
Joined: Aug 2008
Posts: 308

View Profile
types
These are used at compile time only.
Logged
Offline (Male) Josh @ Dreamland
Reply #16 Posted on: February 20, 2010, 11:00:32 PM

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

View Profile Email
A bounds check every time a sprite is drawn? That's just one of them that really sticks in my mind. I might prevent the untimely death of the game by modding the index by the number of sprites, but aside from that... Hell, I wouldn't even just mod it. I'd waste another ((1 << ceil(log2(sprite_count))) - sprite_count) * sizeof(sprite_struct*) bytes (as in, wrap the sprites to a greater power of two) and use an & instead.

It's the little, "oh, this won't really hurt anything" ideas that end up in projects behaving like GM. "Oh, all those local variables are negligible." "Oh, using a map to store array elements won't slow anything." Whatever I can save, I will, or it'll all build up into slow gunk.

Also, score_, I'm not sure if all structs are compile-only in the sense that they will not affect size if unused. I'm thinking vtables might be stored regardless (Not a C thing).
« Last Edit: February 20, 2010, 11:02:11 PM by Josh @ Dreamland » 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) Micah
Reply #17 Posted on: February 21, 2010, 12:05:54 PM

Resident Troll
Joined: May 2008
Posts: 129

View Profile
Premature optimization is the root of all evil.
« Last Edit: February 21, 2010, 12:10:05 PM by miky » Logged
Offline (Male) Josh @ Dreamland
Reply #18 Posted on: February 21, 2010, 12:38:37 PM

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

View Profile Email
Quote
Well, I meant more like being able to check functions only in certain moments where the user would want it using the functions, hopefully without too major speed loss. E.g. you could call "error_start()" to start being error checking session and "error_stop()" to stop it, or perhaps "error_object(obj, true)" to check for errors that occur within a certain object and "error_object(obj, false)". Just suggesting...

The former (error_start) leaves two options.
1) Have an if() to check if it's enabled, which wastes the same a mount of time as just doing the damn error checking
2) Use function pointers that can be swapped on error_start(), which removes any chance of inlining.

The latter (error_object) is a terrible idea by any standard. Now instead of one if(), we're looking up whether we are supposed to be generating errors for that object in a... map? Array? Either of them are awful in one way or another (map's lookup time, array's allocation time).

I'd be better off just leaving the errors than to add functions for them, but I'd rather not have them when they aren't needed.
« Last Edit: February 21, 2010, 12:40:56 PM by Josh @ Dreamland » 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 (Female) IsmAvatar
Reply #19 Posted on: February 21, 2010, 03:18:12 PM

LateralGM Developer
LGM Developer
Location: Pennsylvania/USA
Joined: Apr 2008
Posts: 886

View Profile Email
Quote
Premature optimization is the root of all evil.
I believe this is where Money comes from, too - premature optimization.
Logged
Offline (Unknown gender) Micah
Reply #20 Posted on: February 21, 2010, 08:00:43 PM

Resident Troll
Joined: May 2008
Posts: 129

View Profile
Money is incredibly convenient and great. The love of money is the root of all evil. So all you get from premature optimization is greed, not actual money.
Logged
Offline (Male) RetroX
Reply #21 Posted on: February 21, 2010, 09:16:58 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
types
These are used at compile time only.
I wouldn't know, but thanks for letting me know.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Unknown gender) luiscubal
Reply #22 Posted on: February 22, 2010, 11:48:34 AM
Member
Joined: Jun 2009
Posts: 452

View Profile Email
All that matters for the compiled version is not the type, but rather the *size* of the type.
So, if "weirdstruct" and "long long" happen to have the same size, the compiled version does not distinguish both.
An important exception to this rule is double vs int, which happen to have different assembly instructions(opcodes) and registers on some platforms, so in this case compiled code makes a distinction. Even then, only opcodes and registers differ. It can be really hard to figure out the original type of something. typedefs in particular are pretty much like #define.
Logged
Offline (Female) serprex
Reply #23 Posted on: February 22, 2010, 10:46:12 PM
Smooth ER
Developer
Joined: Apr 2008
Posts: 106

View Profile WWW
Quote
(03:18:56) Nark Pvermars: draw_mandlebrot
(03:18:57) Nark Pvermars: do it
(03:18:58) Nark Pvermars: fgt
Enigma now supports more drawing functions than GM. At least 2dwise, for now. But don't worry, we'll have d3d_draw_mandlebrot to beat YYG there too when the time comes

And d3d_draw_mandlebrot will have an UNMANLY label too
Logged
Offline (Unknown gender) score_under
Reply #24 Posted on: February 23, 2010, 02:15:56 PM

Member
Joined: Aug 2008
Posts: 308

View Profile
It's funny because neither of you can spell mandelbrot.
Logged
Offline (Male) Josh @ Dreamland
Reply #25 Posted on: February 23, 2010, 05:17:23 PM

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

View Profile Email
Oh yes, that's funny. I'm dyslexic, asshole. ...haha.
Fine, maybe I just can't spell old dead people.
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 (Female) IsmAvatar
Reply #26 Posted on: February 23, 2010, 05:19:30 PM

LateralGM Developer
LGM Developer
Location: Pennsylvania/USA
Joined: Apr 2008
Posts: 886

View Profile Email
It can't be worse than GM, where one of the constants was cr_arrrow.
Logged
Offline (Male) Josh @ Dreamland
Reply #27 Posted on: February 23, 2010, 05:21:34 PM

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

View Profile Email
BAHAHAHAHAHAHAHAHAHAHHAHAHAHA
How'd the documentation for that look?
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) RetroX
Reply #28 Posted on: February 23, 2010, 08:54:20 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
It can't be worse than GM, where one of the constants was cr_arrrow.
...are you serious?
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Unknown gender) freezway
Reply #29 Posted on: February 23, 2010, 10:18:35 PM

Member
Joined: Dec 2009
Posts: 220

View Profile
just checked it... not only is there cr_arrrow there is ALSO  the correct spelling... cr_arrow.
Logged
if you drop a cat with buttered toast strapped to its back, which side lands down?
joshdreamland: our languages are based on the idea that it's going to end up FUBAR
/kick retep998
Pages: « 1 2 3 »
  Print