From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id HAA21492 for caml-red; Tue, 24 Oct 2000 07:17:12 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA10724 for ; Mon, 23 Oct 2000 18:28:10 +0200 (MET DST) Received: from staff.gtmd.com (adsl-63-195-80-23.dsl.snfc21.pacbell.net [63.195.80.23]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id e9NGS8v00282 for ; Mon, 23 Oct 2000 18:28:09 +0200 (MET DST) Received: from aria.chasm.org (aria [192.168.0.3]) by staff.gtmd.com (8.9.3/8.9.3) with ESMTP id JAA46615 for ; Mon, 23 Oct 2000 09:26:07 -0700 (PDT) (envelope-from martin@chasm.org) Message-Id: <5.0.0.25.0.20001023090935.00a698c0@chasm.org> X-Sender: martin@chasm.org X-Mailer: QUALCOMM Windows Eudora Version 5.0 Date: Mon, 23 Oct 2000 09:28:52 -0400 To: caml-list@inria.fr From: Charles Martin Subject: Re: single-precision floats, etc. In-Reply-To: <20001019111110.49008@pauillac.inria.fr> References: <4.3.2.7.2.20001016110744.01e9d660@shell16.ba.best.com> <4.3.2.7.2.20001016110744.01e9d660@shell16.ba.best.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: weis@pauillac.inria.fr >I'm curious to why you need single floats. It's certainly not for >speed, because most processors nowadays do not compute over single I would want single floats for space, not speed! The history of video game development is a fight for space on a limited memory processor. Single versus double is a factor of two in the space requirements for vertex data and etc. I, too, am deeply interested in using FP for video game development. I have seen far too many pages and pages of C/C++ code that could have been reduced to a few higher-order functions. I went so far as to drop by ICFP in Montreal for a day this year to meet some of the Scheme/OCaml/ML implementors. On the subject of GC, the GC pause times are the obvious first problem with FP in video game development, but the space overhead is important as well. I was interested in the earlier thread on memory overhead for various GC schemes; Damien Doligez mentioned that OCaml has a 1.42 times overhead. If your average data structure is three words (two-word pairs are half of most FP allocations, I recall reading somewhere), with the header word you are paying [(3+1)*1.42=5.68] almost a 90% space overhead. So using double instead of single floats means that your game as a whole will require approximately twice as much space as a non-FP implementation. Of course, you will gain since you (presumeably) won't have to engage in typical video game coding stunts like allocating large data structures at the maximum possible size used by the game, only to have the majority of levels or whatever only require half your allocation. How it all balances out in the mix is an open question.