avoiding game gc's?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

avoiding game gc's?

Raoul Duke
hi,

so how do you go about writing code in haxe to minimize needing gc's?
presumably a bit hard to do in a cross-platform way, to boot?

thanks.

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: avoiding game gc's?

Tarwin Stroh-Spijer
Guess what you want is an object pool. I know there's a few implementations floating around, maybe Polygonal has one?

The idea is that you make a bunch of objects and keep them in a list/array and just get one if you need it, and return it to the pool when you're done. Means you only have the initial time / memory set aside, then things should run without pausing etc from there.


Tarwin Stroh-Spijer
_______________________

Touch My Pixel
http://www.touchmypixel.com/
phone: +61 3 8060 5321
_______________________


On Mon, Apr 11, 2011 at 9:04 AM, Raoul Duke <[hidden email]> wrote:
hi,

so how do you go about writing code in haxe to minimize needing gc's?
presumably a bit hard to do in a cross-platform way, to boot?

thanks.

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: avoiding game gc's?

Dion Whitehead Amago
Yes, there's the efficient one in polygonal, and a less efficient,
simple one in hydrax.

On Sun, Apr 10, 2011 at 6:23 PM, Tarwin Stroh-Spijer
<[hidden email]> wrote:

> Guess what you want is an object pool. I know there's a few implementations
> floating around, maybe Polygonal has one?
> The idea is that you make a bunch of objects and keep them in a list/array
> and just get one if you need it, and return it to the pool when you're done.
> Means you only have the initial time / memory set aside, then things should
> run without pausing etc from there.
>
>
> Tarwin Stroh-Spijer
> _______________________
>
> Touch My Pixel
> http://www.touchmypixel.com/
> phone: +61 3 8060 5321
> _______________________
>
>
> On Mon, Apr 11, 2011 at 9:04 AM, Raoul Duke <[hidden email]> wrote:
>>
>> hi,
>>
>> so how do you go about writing code in haxe to minimize needing gc's?
>> presumably a bit hard to do in a cross-platform way, to boot?
>>
>> thanks.
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: avoiding game gc's?

Gamehaxe
In reply to this post by Tarwin Stroh-Spijer
Hi,
On this note, list items require the creation of an object in hxcpp,
so using an array you be better if you goal is to reduce object  
allocations.

Hugh

> Guess what you want is an object pool. I know there's a few  
> implementations
> floating around, maybe Polygonal has one?
>
> The idea is that you make a bunch of objects and keep them in a  
> list/array
> and just get one if you need it, and return it to the pool when you're  
> done.
> Means you only have the initial time / memory set aside, then things  
> should
> run without pausing etc from there.
>
>
> Tarwin Stroh-Spijer
> _______________________
>
> Touch My Pixel
> http://www.touchmypixel.com/
> phone: +61 3 8060 5321
> _______________________
>
>
> On Mon, Apr 11, 2011 at 9:04 AM, Raoul Duke <[hidden email]> wrote:
>
>> hi,
>>
>> so how do you go about writing code in haxe to minimize needing gc's?
>> presumably a bit hard to do in a cross-platform way, to boot?
>>
>> thanks.
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: avoiding game gc's?

Raoul Duke
In reply to this post by Tarwin Stroh-Spijer
hi,

On Sun, Apr 10, 2011 at 4:23 PM, Tarwin Stroh-Spijer
<[hidden email]> wrote:
> Guess what you want is an object pool. I know there's a few implementations
> floating around, maybe Polygonal has one?

Ja, I already have my own object pool. :-) But I am assuming there is
more to avoding gc's than that -- it probably depends though on how
nit-picky-anal one is about "down with gc's!".

like, what in haxe translates into a 'new' in the underlying target
languages? i assume that any time i use "new" in haXe then i am really
getting a "new" in the target, ok. but then there are probably other
things in haXe that aren't obviously newing. there are 2 cases (a)
both haXe and the underlying language hide the memory hit for the sake
of higher level programming clarity [javascript] or (b) haXe hides it
but the underlying language wouldn't [c++].

and then of course there are the 3rd party libraries. presumably my
current problem is that i don't know wtf i'm doing with nme, but my js
version with object pool runs fine, whereas my nme version also with
object pool crawls to a halt very quickly.

so i'd guess it is a fairly wide-ranging question. would be nifty if
there were a place on the haXe site where people could add
bullet-points of best practices they've experienced. (obviously the
first one is to actually profile under the real targets! that's the
only way to really attack performance. ;-)

sincerely.

sincerely.

--
haXe - an open source web programming language
http://haxe.org