[Haskell-cafe] Re: Memory efficiency questions for real-time graphics
Don Stewart wrote: wqeqweuqy: T Willingham wrote: On Sat, Nov 1, 2008 at 3:15 AM, Neal Alexander <[EMAIL PROTECTED]> wrote: Even when generating one or more copies of "world" per frame the performance stays fine and allocations are minimal. Who says? That may be your particular experience from your particular tests. In my case, any copy of the "world" on each frame would have a catastrophic effect on the framerate, for any such definition of "world". Yea, this is just from my recent experience messing with a game engine in Haskell - I'm only a few months into it though. So far, the GC hasn't been anywhere close to having a problem keeping up with the monitors refresh rate. Even with several world states being folded into a frame. The memory usage is pretty flat too, at least with GLFW (the GLUT bindings had some issues there iirc). The test is pulling a pretty constant 1500 fps on this machine with the background + 1 character running around and resources being streamed in lazily. Not that that means much, but at the very least a GC run isn't noticeable on the current data set. Initially i expected this setup to perform badly, but i tried it anyway out of curiosity. We'll see how it goes with full sets of data later i guess heh. And, just to double check, you're compiling with a modern GHC, using say, -O2 -fvia-C -optc-O2 -funbox-strict-fields ? -- Don Yea the optimization flags don't have any real effect on the FPS atm. The engine is bottlenecked by the OGL specific stuff. The way it looks now i don't think theres going to be any performance problems - not that this is trying to be a bleeding edge 3d engine, but whatever. Tree data structures seem to adapt pretty well to being recreated each frame. I'm not sure how smart the GC is in regards to that though. Using matrices the same way performed really poorly. Replacing the matrix with a Region-QuadTrie caused a huge performance boost. IIRC the matrix stuff was using like 30% cpu according to the profile data and the Tree based approach used basicly 0% heh. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] An irritating Parsec problem
On Wed, Oct 15, 2008 at 12:20 PM, Jonathan Cast <[EMAIL PROTECTED]>wrote: > This is a bit > easier if you supply the missing Applicative instance: > > const <$> parser <*> eof > > Too verbose. parser <* eof ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Memory efficiency questions for real-time graphics
wqeqweuqy: > T Willingham wrote: > > >On Sat, Nov 1, 2008 at 3:15 AM, Neal Alexander <[EMAIL PROTECTED]> > >wrote: > >>Even when generating one or more copies of "world" per frame the > >>performance > >>stays fine and allocations are minimal. > > > >Who says? That may be your particular experience from your particular > >tests. In my case, any copy of the "world" on each frame would have a > >catastrophic effect on the framerate, for any such definition of > >"world". > > > > Yea, this is just from my recent experience messing with a game engine > in Haskell - I'm only a few months into it though. > > So far, the GC hasn't been anywhere close to having a problem keeping up > with the monitors refresh rate. Even with several world states being > folded into a frame. > > The memory usage is pretty flat too, at least with GLFW (the GLUT > bindings had some issues there iirc). > > The test is pulling a pretty constant 1500 fps on this machine with the > background + 1 character running around and resources being streamed in > lazily. Not that that means much, but at the very least a GC run isn't > noticeable on the current data set. > > > Initially i expected this setup to perform badly, but i tried it anyway > out of curiosity. We'll see how it goes with full sets of data later i > guess heh. > And, just to double check, you're compiling with a modern GHC, using say, -O2 -fvia-C -optc-O2 -funbox-strict-fields ? -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Memory efficiency questions for real-time graphics
T Willingham wrote: On Sat, Nov 1, 2008 at 3:15 AM, Neal Alexander <[EMAIL PROTECTED]> wrote: Even when generating one or more copies of "world" per frame the performance stays fine and allocations are minimal. Who says? That may be your particular experience from your particular tests. In my case, any copy of the "world" on each frame would have a catastrophic effect on the framerate, for any such definition of "world". Yea, this is just from my recent experience messing with a game engine in Haskell - I'm only a few months into it though. So far, the GC hasn't been anywhere close to having a problem keeping up with the monitors refresh rate. Even with several world states being folded into a frame. The memory usage is pretty flat too, at least with GLFW (the GLUT bindings had some issues there iirc). The test is pulling a pretty constant 1500 fps on this machine with the background + 1 character running around and resources being streamed in lazily. Not that that means much, but at the very least a GC run isn't noticeable on the current data set. Initially i expected this setup to perform badly, but i tried it anyway out of curiosity. We'll see how it goes with full sets of data later i guess heh. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Haskell Weekly News: Issue 91 - November 1, 2008
--- Haskell Weekly News http://sequence.complete.org/hwn/20081101 Issue 91 - November 01, 2008 --- Welcome to issue 91 of HWN, a newsletter covering developments in the [1]Haskell community. Announcements blas version 0.6. Patrick Perry [2]announced a [3]new version of the Haskell BLAS bindings, now with support for the ST monad! darcs hacking sprint #1 (report). Eric Y. Kow [4]summarized the [5]progress made during the darcs hacking sprint last weekend. Looks like exciting stuff! Much more detail and links can be found in Eric's original email. LAST CALL: Haskell Communities and Activities Report. Janis Voigtlaender [6]is extending the submission deadline for the 15th edition of the Haskell Community and Activities Report by a few days. If you haven't already, please [7]write an entry for your new project or update your old entry. Data.TCache 0.5.1. Alberto G. Corona [8]announced the release of [9]Data.TCache, which implements a transactional cache with configurable persistence. It tries to simulate Hibernate for Java or Rails for Ruby; the main difference is that transactions are done in memory trough STM. multirec-0.1. Andres Loeh [10]announced the release of the [11]multirec package, which provides a mechanism to talk about fixed points of systems of datatypes that may be mutually recursive. On top of this representations, generic functions such as the fold or the Zipper can then be defined. Making 'Super Nario Bros.' in Haskell. Korcan Hussein [12]linked to a [13]super mario brothers clone which was [14]written in Haskell! Chart-0.9. Tim Docker [15]announced the 0.9 release of the [16]Chart library, a library for drawing 2D charts. Publication of InputYourData.com + Project Announcement. Enzo Haussecker [17]announced the publication of [18]InputYourData.com, an online tool, written in Haskell, for financial, mathematical and scientific calculations. Enzo also described an idea to create a similar website where web applications are created by the user. If you are intrigued by this project and have substantial experience in designing Haskell-based web applications, please send Enzo your resume and a brief summery of why you are interested. Blog noise [19]Haskell news from the [20]blogosphere. * Mark Jason Dominus: [21]Atypical Typing. Mark describes his OOPSLA talk about Haskell's type system. * Eric Kow (kowey): [22]official darcs blog!. * Ben Moseley: [23]2 Minute intro to Associated Types / Type Families. * Ivan Lazar Miljenovic: [24]Honours + LXDE. Ivan discusses the status of his Haskell-oriented Mathematics Honours thesis. * Jason Dagit: [25]Darcs Hacking Sprint - Summary from Portland Team. * Eric Kow (kowey): [26]darcs hacking sprint - Team Brighton Day 2. * Dan Piponi (sigfpe): [27]Operads and their Monads. Quotes of the Week * lispy: I just wanted to make sure that this was illegal first * quicksilver: it doesn't entirely help that SQL is a series of broken standards layered over very poor decisions by large corporations * Baughn: SingInTime> hello world SingInTime: Type mismatch: Expected type: IRC [a], inferred type: IO () About the Haskell Weekly News New editions are posted to [28]the Haskell mailing list as well as to [29]the Haskell Sequence and [30]Planet Haskell. [31]RSS is also available, and headlines appear on [32]haskell.org. To help create new editions of this newsletter, please see the information on [33]how to contribute. Send stories to byorgey at cis dot upenn dot edu. The darcs repository is available at darcs get [34]http://code.haskell.org/~byorgey/code/hwn/ . References 1. http://haskell.org/ 2. http://article.gmane.org/gmane.comp.lang.haskell.cafe/47117 3. http://quantile95.com/2008/10/31/ann-blas-bindings-for-haskell-version-06/ 4. http://article.gmane.org/gmane.comp.lang.haskell.cafe/47114 5. http://blog.darcs.net/2008/10/darcs-hacking-sprint-1-report.html 6. http://article.gmane.org/gmane.comp.lang.haskell.cafe/47078 7. http://www.haskell.org/pipermail/haskell/2008-October/020651.html 8. http://article.gmane.org/gmane.comp.lang.haskell.cafe/47016 9. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/TCache 10. http://article.gmane.org/gmane.comp.lang.haskell.general/16574 11. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/multirec 12. http://article.gmane.org/gmane.comp.lang.haskell.general/16572 13. http://uk.youtube.com/watch?v=gVLFGQGRsDw 14. http://svn.coderepos.org/share/lang/haskell/nario/ 15. http://article.gmane.org/gmane.comp.lang.haskell.general/16570 16. http://dockerz.n
Re: [Haskell-cafe] ANN: blas version 0.6
patperry: > New version of BLAS bindings out. Now with support for the ST monad! > This breaks backwards compatibility, unfortunately. > > More info (and some sample code) here: > http://quantile95.com/2008/10/31/ann-blas-bindings-for-haskell-version-06/ > > Also, if you want to help, please let me know. There is plenty of > work to do. > Great work! This stuff was sorely needed, so I'm glad a champion has appeared to lead the work. -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Memory efficiency questions for real-time graphics
On Tue, Oct 28, 2008 at 3:24 PM, Sebastian Sylvan <[EMAIL PROTECTED]> wrote: > 2008/10/28 T Willingham <[EMAIL PROTECTED]> >> >> To give a context for all of this, I am applying a non-linear >> transformation to an object on every frame. (Note: non-linear, so a >> matrix transform will not suffice.) > > Any reason why you can not do this in the vertex shader? You really should > avoid trying to touch the vertices with the CPU if at all possible. The per-vertex computation is a quite complex time-dependent function applied to the given domain on each update. Yet even if it were simple, I would still first implement the formulas in Haskell and leave the optimization for later, if at all. The current C++ implementation which uses userland-memory vertex arrays already performs very well. On Sat, Nov 1, 2008 at 3:15 AM, Neal Alexander <[EMAIL PROTECTED]> wrote: > Even when generating one or more copies of "world" per frame the performance > stays fine and allocations are minimal. Who says? That may be your particular experience from your particular tests. In my case, any copy of the "world" on each frame would have a catastrophic effect on the framerate, for any such definition of "world". > From what ive seen, the OpenGL calls are whats going to bottle neck. Yes, that may as well be a tautology. The problem is sporadic lag and jittering from occasional large allocations and/or garbage collection from frequent small allocations. It's a unique situation where even the best profiling cannot pinpoint what is blatantly obvious to the human eye. Though the profiler may register it as 0.01%, the actual effect is glitchy behavior which comes off as unprofessional. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] number of references to a variable
Jan-Willem Maessen wrote: On Nov 1, 2008, at 9:38 AM, Andrew Coppin wrote: Alberto G. Corona wrote: Is there a way to know the number of memory references for a variable?. The runtime must know it but i do not know if this available for the program trough any low level trick More precisely, the GC computes it each time it runs. (And only computes it precisely during a "major" pass, not the more frequent "minor" passes.) Even this isn't quite true for most GC algorithms. The GC only needs to compute whether there is 0 or >= 1 reference to a given location. If you can see it, the answer is always >=1, so this information is much less useful than you might think! Quite right. Usually the clever thing you want to know is "this is the sole reference to the pointed-to object". Does GHC have weak references? (I seem to recall it does...) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] number of references to a variable
On Nov 1, 2008, at 9:38 AM, Andrew Coppin wrote: Alberto G. Corona wrote: Is there a way to know the number of memory references for a variable?. The runtime must know it but i do not know if this available for the program trough any low level trick More precisely, the GC computes it each time it runs. (And only computes it precisely during a "major" pass, not the more frequent "minor" passes.) Even this isn't quite true for most GC algorithms. The GC only needs to compute whether there is 0 or >= 1 reference to a given location (with some special weasel words for stuff with finalizers defined). If you can see it, the answer is always >=1, so this information is much less useful than you might think! Usually the clever thing you want to know is "this is the sole reference to the pointed-to object". If that's what you're interested in, try looking up "one-bit reference counting", but note that like any accurate reference counting technique it's really inefficient in practice compared to GC. [There are efficient reference counting techniques, but they defer refcount updates in various subtle ways. Also, every ref count technique requires a cycle detector.] -Jan-Willem Maessen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Array bug?
Hello Bertram, Saturday, November 1, 2008, 5:14:30 PM, you wrote: > Yes, it's a known bug - a conscious choice really. See > http://hackage.haskell.org/trac/ghc/ticket/2120 does it possible to do both checks? -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: number of references to a variable
On 1 Nov 2008, at 16:33, Achim Schneider wrote: "Alberto G. Corona " <[EMAIL PROTECTED]> wrote: Is there a way to know the number of memory references for a variable?. The runtime must know it but i do not know if this available for the program trough any low level trick Flameproof vests, cheap and safe! Get yours now before it's too late! Save one for me, please! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Array bug?
Bertram Felgenhauer wrote: Yes, it's a known bug - a conscious choice really. See http://hackage.haskell.org/trac/ghc/ticket/2120 It's somewhat ironic that this behaviour was introduced by a patch that made arrays safer to use in other respects. ...so it's *not* going to be fixed then? That's just fantastic. Nice to know that Haskell takes safety seriously... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Array bug?
Andrew Coppin wrote: > Consider the following GHCi session: > > GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help > Prelude Data.Array.IO> t <- newArray ((0,0),(5,4)) 0 :: IO (IOUArray > (Int,Int) Int) > Prelude Data.Array.IO> getBounds t > ((0,0),(5,4)) > Prelude Data.Array.IO> > > Is this a known bug? Is it likely to be fixed any time soon? (I'm guessing > the bug is as simple is converting indicies to integers and then checking > the integers are in-range, rather than the underlying index type.) Yes, it's a known bug - a conscious choice really. See http://hackage.haskell.org/trac/ghc/ticket/2120 It's somewhat ironic that this behaviour was introduced by a patch that made arrays safer to use in other respects. Bertram ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] number of references to a variable
Alberto G. Corona wrote: Is there a way to know the number of memory references for a variable?. The runtime must know it but i do not know if this available for the program trough any low level trick More precisely, the GC computes it each time it runs. (And only computes it precisely during a "major" pass, not the more frequent "minor" passes.) You can attach a finaliser to an object, and that'll allow you to know when the reference count reaches zero. But beyond that, I don't know. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: number of references to a variable
"Alberto G. Corona " <[EMAIL PROTECTED]> wrote: > Is there a way to know the number of memory references for a > variable?. The runtime must know it but i do not know if this > available for the program trough any low level trick > Flameproof vests, cheap and safe! Get yours now before it's too late! -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or quoting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] number of references to a variable
Is there a way to know the number of memory references for a variable?. The runtime must know it but i do not know if this available for the program trough any low level trick Thanks ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Array bug?
Consider the following GHCi session: GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ... done. Prelude> :m Data.Array.IO Prelude Data.Array.IO> t <- newArray ((0,0),(5,4)) 0 :: IO (IOUArray (Int,Int) Int) Loading package array-0.1.0.0 ... linking ... done. Prelude Data.Array.IO> getBounds t ((0,0),(5,4)) Prelude Data.Array.IO> writeArray t (10,10) 5 *** Exception: Error in array index Prelude Data.Array.IO> writeArray t (7,3) 5 *** Exception: Error in array index Prelude Data.Array.IO> writeArray t (3,7) 5 Prelude Data.Array.IO> So the array has 0 <= x <= 5 and 0 <= y <= 4, and writing to (10,10) or (7,3) throws an exception. However, writing to (3,7) triggers no exception - despite being clearly out of range. Judging by the behaviour of the large, complex program I was debugging when I stumbled upon this, the coordinates "wrap round" to the next column. (!!) Obviously, writing to non-existent coordinates and not getting an exception is a Very Bad Thing. I was counting on writeArray (and readArray) to detect out-of-range coordinates so I could fix my code. But as you can see, it doesn't actually work as advertised. You have *no idea* how long I spent trying to track this bug down! >_< Is this a known bug? Is it likely to be fixed any time soon? (I'm guessing the bug is as simple is converting indicies to integers and then checking the integers are in-range, rather than the underlying index type.) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: blas version 0.6
New version of BLAS bindings out. Now with support for the ST monad! This breaks backwards compatibility, unfortunately. More info (and some sample code) here: http://quantile95.com/2008/10/31/ann-blas-bindings-for-haskell-version-06/ Also, if you want to help, please let me know. There is plenty of work to do. Patrick ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Memory efficiency questions for real-time graphics
Even when generating one or more copies of "world" per frame the performance stays fine and allocations are minimal. From what ive seen, the OpenGL calls are whats going to bottle neck. loop (time, space) where loop = loop <=< runKleisli action where action = (ChronoSync.sync *** syncExternal channel) >>> Space.update >>> display >>> ChronoSync.yieldCPU ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe