Re: [Caml-list] How could I implement an efficient ring buffer?

2012-04-02 Thread Francois Berenger
On 04/02/2012 11:31 PM, Hongbo Zhang wrote: Hi List, I want to implement sliding window algorithm (in place, no memory copy), I wonder whether I need to write c code. Queues are described in Chris Okasaki's book, with a functional implementation in all senses of the term. If you don't want t

RE: [Caml-list] How could I implement an efficient ring buffer?

2012-04-02 Thread Jon Harrop
The "mod" and the write barrier will significantly degrade performance vs C. Probably faster to replace "mod" with if-based wrap around but there's nothing you can do about the write barrier. Cheers, Jon. > -Original Message- > From: David Allsopp [mailto:dra-n...@metastack.com] > Sent:

Re: [Caml-list] How could I implement an efficient ring buffer?

2012-04-02 Thread Benedikt Grundmann
Use core's Dequeue module. Cheers, Bene On 2 April 2012 15:31, Hongbo Zhang wrote: > Hi List, >   I want to implement sliding window algorithm (in place, no memory copy), I > wonder whether I need to write c code. > >   To make it clear and simple, >      In c, you can record the head pointer o

Re: [Caml-list] How could I implement an efficient ring buffer?

2012-04-02 Thread Gabriel Scherer
A small implementation of a FIFO queue implemented as a circular buffer of fixed length: type 'a circular_buffer = { mutable pos : int; mutable count : int; data : 'a array; size : int; } let create size dummy = { pos = 0; count = 0; data = Array.make size dummy; size; } let push

RE: [Caml-list] How could I implement an efficient ring buffer?

2012-04-02 Thread David Allsopp
Hongbo Zhang wrote: > Hi List, > I want to implement sliding window algorithm (in place, no memory > copy), I wonder whether I need to write c code. > > To make it clear and simple, >In c, you can record the head pointer of the array, and do the > modulo operations when get and set

[Caml-list] How could I implement an efficient ring buffer?

2012-04-02 Thread Hongbo Zhang
Hi List, I want to implement sliding window algorithm (in place, no memory copy), I wonder whether I need to write c code. To make it clear and simple, In c, you can record the head pointer of the array, and do the modulo operations when get and set In ocaml, it seems you hav

Re: [Caml-list] Strategies for finding memory leaks

2012-04-02 Thread Hans Ole Rafaelsen
Just did another run to be sure. It does not do any swapping. -- Hans Ole On Mon, Apr 2, 2012 at 12:13 PM, Richard W.M. Jones wrote: > > On Mon, Apr 02, 2012 at 10:15:02AM +0200, Hans Ole Rafaelsen wrote: > > However, the application still consumes more and more CPU time. And it > > seems to ha

[Caml-list] Second call for papers TFPIE 2012 (including registration information)

2012-04-02 Thread Peter Achten
CALL FOR PAPERS/PRESENTATIONS TFPIE 2012 International Workshop on Trends in Functional Programming in Education 2012 June 11 2012 University of St Andrews, Scotland http://www.cs.ru.nl/P.Achten/TFPIE_2012/TFPIE_2012_home.html *** NEW: The deadline to register for accommodations through the TFP w

[Caml-list] Second call for papers TFPIE 2012

2012-04-02 Thread Peter Achten
CALL FOR PAPERS/PRESENTATIONS TFPIE 2012 International Workshop on Trends in Functional Programming in Education 2012 June 11 2012 University of St Andrews, Scotland http://www.cs.ru.nl/P.Achten/TFPIE_2012/TFPIE_2012_home.html The first International Workshop on Trends in Functional Programming

Re: [Caml-list] Re: New version of the binary installer for Windows

2012-04-02 Thread Jonathan Protzenko
Just to make things very clear: 1) the ocaml compilers that the installer packages are built with mingw-w64, so they don't depend on cygwin1.dll 2) the installer advertises cygwin as a convenience environment (so that there's make, bash, and the like), but the executables produced by the instal

Re: [Caml-list] Re: New version of the binary installer for Windows

2012-04-02 Thread Romain Bardou
Le 02/04/2012 13:14, Adrien a écrit : On 02/04/2012, Romain Bardou wrote: Le 30/03/2012 16:15, Jonathan Protzenko a écrit : Hi again, Following all the good suggestions in this thread, I've updated the installer. It now downloads and runs cygwin's setup.exe so as to provide a fully working en

Re: [Caml-list] Strategies for finding memory leaks

2012-04-02 Thread John Carr
Cache misses count as CPU time. I've seen people measure parallel speedup by looking at CPU usage. They get linear increase in CPU use to eight threads even though the task saturated memory bandwidth after the second thread. If you have a way to measure instruction count you can compare increas

Re: [Caml-list] Re: New version of the binary installer for Windows

2012-04-02 Thread Adrien
On 02/04/2012, Romain Bardou wrote: > Le 30/03/2012 16:15, Jonathan Protzenko a écrit : >> Hi again, >> >> Following all the good suggestions in this thread, I've updated the >> installer. It now downloads and runs cygwin's setup.exe so as to provide >> a fully working environment for OCaml on win

Re: [Caml-list] Strategies for finding memory leaks

2012-04-02 Thread Richard W.M. Jones
On Mon, Apr 02, 2012 at 10:15:02AM +0200, Hans Ole Rafaelsen wrote: > However, the application still consumes more and more CPU time. And it > seems to happen in the GC. Apart from that, the application seems to be > just fine. So it seems to be something in our code (or in LablGTK) that is > maki

RE: [Caml-list] Re: New version of the binary installer for Windows

2012-04-02 Thread David Allsopp
Romain Bardou wrote: > Le 30/03/2012 16:15, Jonathan Protzenko a écrit : > > Hi again, > > > > Following all the good suggestions in this thread, I've updated the > > installer. It now downloads and runs cygwin's setup.exe so as to > > provide a fully working environment for OCaml on windows after

Re: [Caml-list] Re: New version of the binary installer for Windows

2012-04-02 Thread Alain Frisch
On 04/02/2012 10:03 AM, Romain Bardou wrote: I always heard that if you compile your program under the Cygwin environment, then the application needs to be run under the Cygwin environment as well; whereas if you use MinGW, you produce stand-alone executables. Is that still the case? It depends

Re: [Caml-list] Strategies for finding memory leaks

2012-04-02 Thread Hans Ole Rafaelsen
Hi, We have done some further investigation, and it does not seem to be memory leakage. The application is a video streaming application, where we use external processes to encode and decode the video. By configuring it in different ways, we have found the problem to be in the code that is reading

Re: [Caml-list] Re: New version of the binary installer for Windows

2012-04-02 Thread Romain Bardou
Le 30/03/2012 16:15, Jonathan Protzenko a écrit : Hi again, Following all the good suggestions in this thread, I've updated the installer. It now downloads and runs cygwin's setup.exe so as to provide a fully working environment for OCaml on windows after the installer completes. The cygwin inst