This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
1
Function Peer Review / Re: move_towards_point
« on: January 08, 2011, 02:55:22 pm »
No, they shouldn't
2
Function Peer Review / Re: clamp()
« on: December 14, 2010, 09:02:45 am »
Get out your minmax, let's go out tonight, it'll be a bang and the whole gang'll rival up on in with the llllllllllittle cherries and sweeeeeeeeeeet comparies. So get out your min(max(x,lower),upper) tonight
3
General ENIGMA / Re: variable_* Functions
« on: December 13, 2010, 09:04:15 am »
These are better replaced by string indices
5
Off-Topic / Re: C++0x and garbage collection
« on: November 19, 2010, 12:57:23 pm »
It's standard in C99
6
Announcements / Re: r/coderaid
« on: November 19, 2010, 12:42:58 pm »
Reddit is a bit different than digg. There's a few subreddits which go beyond the upvote/downvote. Coderaid was recently spawned more as a forum
7
Off-Topic / Re: C++0x and garbage collection
« on: November 18, 2010, 07:06:36 pm »
Stack variables are allocated all together. Static variables are not faster than the stack. The stack let's different code reuse the same memory. Keeping variables declared at the inner most scope is best, as it gets reused rather than redefined (Register allocation.) Those two kinds of memory don't suffer fragmentation, and don't have to deal with runtime allocation. This limits pretty close to malloc/free, which becomes close to mmap if you use large blocks which are then partitioned by one's own means. See things like arenas and pools. To understand more about malloc/free, read about free lists
Rusky contends that GC helps cache locality, but preferably one designs their objects to maintain locality by explicitly putting them together in memory, which resolves the issue also. That's the issue I have with people saying that JITs are going to bypass C: In Java, the JIT proves that array bounds are safe, and stops checking. In C, the compiler assumes the array bounds are safe, and doesn't check. One has a JIT to deal with, the other doesn't
Also, Rusky, LLVM doesn't have very good mechanisms for GC. They have some hooks to facillitate a shadow stack, but that says nothing of how much C++'s semantics fail to facillitate garbage collection. Hence Boehm admits that it cannot be standard compliant, only implementation friendly
And at that last part of I still don't know enough about it: Neither is ever always the right. Hence D allows the programmer to disable the GC for some things
Rusky contends that GC helps cache locality, but preferably one designs their objects to maintain locality by explicitly putting them together in memory, which resolves the issue also. That's the issue I have with people saying that JITs are going to bypass C: In Java, the JIT proves that array bounds are safe, and stops checking. In C, the compiler assumes the array bounds are safe, and doesn't check. One has a JIT to deal with, the other doesn't
Also, Rusky, LLVM doesn't have very good mechanisms for GC. They have some hooks to facillitate a shadow stack, but that says nothing of how much C++'s semantics fail to facillitate garbage collection. Hence Boehm admits that it cannot be standard compliant, only implementation friendly
And at that last part of I still don't know enough about it: Neither is ever always the right. Hence D allows the programmer to disable the GC for some things
8
Off-Topic / Re: C++0x and garbage collection
« on: November 18, 2010, 04:53:20 pm »
Retro,
Firefox has areas where it isn't a memory leak that causes high memory usage, but a large amount of fragementation. If you can't allocate memory in evenly sized blocks without being overly pessimistic so that small objects bloat the memory usage though, then I guess that's your own fault
Really I think the issue is that when people say manual memory management, they think malloc/free. I've been leaning more towards mmap as of late, but then you're outside of standard C. I was recently toying with an explicit memory manager which also had compacting, though the implementation was rather brain dead due to the half ass proof of concept nature of the project. Garbage collection is a design pattern, and where it isn't supplied by the underlying framework, it'll end up being poorly implemented by the application. There are a number of refcounted APIs in C, but refcounting isn't necessarily the superior mechanism. It's only that refcounting is suitable for explicit use by the programmer, as it doesn't deviate much from malloc/free
In any case, you should learn to read Rusky's responses at times. He answered your questions, albeit with hostility. He over evangelizes, but that's what happens when one is forced to play devil's advocate in a crowd
Firefox has areas where it isn't a memory leak that causes high memory usage, but a large amount of fragementation. If you can't allocate memory in evenly sized blocks without being overly pessimistic so that small objects bloat the memory usage though, then I guess that's your own fault
Really I think the issue is that when people say manual memory management, they think malloc/free. I've been leaning more towards mmap as of late, but then you're outside of standard C. I was recently toying with an explicit memory manager which also had compacting, though the implementation was rather brain dead due to the half ass proof of concept nature of the project. Garbage collection is a design pattern, and where it isn't supplied by the underlying framework, it'll end up being poorly implemented by the application. There are a number of refcounted APIs in C, but refcounting isn't necessarily the superior mechanism. It's only that refcounting is suitable for explicit use by the programmer, as it doesn't deviate much from malloc/free
In any case, you should learn to read Rusky's responses at times. He answered your questions, albeit with hostility. He over evangelizes, but that's what happens when one is forced to play devil's advocate in a crowd
9
Sound and Music / Re: Re: ENIGMA examples - Graphics: 43% done
« on: November 18, 2010, 04:37:50 pm »
Also notice bass/bassmod
As for your other request, see MID2XM. 2MIDI, unfortunately, seems to not freely license itself to freeware
As for your other request, see MID2XM. 2MIDI, unfortunately, seems to not freely license itself to freeware
10
Sound and Music / Re: Re: ENIGMA examples - Graphics: 43% done
« on: November 18, 2010, 02:19:47 pm »11
Proposals / Re: Thoughts on forum registration...
« on: November 06, 2010, 01:15:25 pm »
What does ENIGMA stand for?
13
Tips, Tutorials, Examples / Re: Chesee finder - pathfinding and collision engine
« on: October 10, 2010, 08:10:30 am »
http://gmc.yoyogames.com/index.php?showtopic=90437 39dll is open source, and it shows that making a DLL isn't that hard
14
Tips, Tutorials, Examples / Re: Chesee finder - pathfinding and collision engine
« on: October 09, 2010, 11:19:32 pm »
segment_triangle.cpp: http://en.wikipedia.org/wiki/Fast_inverse_square_root
What's the data set? If you don't have too many values, consider using doubles. If you're alright having 25% useless data thrashing your cache, consider adjusting vectors to be float[4] so to allow for tree vectorization and other such power of two goodness
get_z:
If you're going to use FUZZY_ZERO, consider using -ffast-math
Code: [Select]
inline void normalize(float* x)
{
float len = 1.0f / sqrtf(dot_product(x, x));
x[0] *= len;
x[1] *= len;
x[2] *= len;
}
He's using inline, so that should deal with aliasingWhat's the data set? If you don't have too many values, consider using doubles. If you're alright having 25% useless data thrashing your cache, consider adjusting vectors to be float[4] so to allow for tree vectorization and other such power of two goodness
get_z:
Code: [Select]
if( fabsf(normal[2]) < FUZZY_ZERO )
return 0.0f; // that means that the triangle is parallel to the Z axis (we cannot retrieve a Z value from X and Y)
// Now, the plane equation is A1*x + B1*y + C1*z + D1 = 0
// solving for "z" yields:
// z = -(A1*x + B1*y + D1) / C1
return (normal[0]*x + normal[1]*y - dot_product(normal, va)) / -normal[2];
This is a little epsilon trigger happy. Better would be to check if it is exactly 0, otherwise let the processor give you the nearly zero value (Unless you're using zero as a signal value?). Another case of overly eager number fudging is in line_segment, where if( det > FUZZY_ZERO ) is better stated as a check on whether a01 is near 1If you're going to use FUZZY_ZERO, consider using -ffast-math
15
Function Peer Review / Re: GML: draw_sprite_tiled + draw_sprite_tiled_ext (unfinished)
« on: September 11, 2010, 12:38:20 pm »
char(alpha*255) is undefined if alpha is above 0.5 or below 0