Re: FIFO

2024-05-14 Thread Salih Dincer via Digitalmars-d-learn
wrote a small performance measurement: put 10,000 things in a FIFO, pull them back out, and loop around that 10,000 times. My FIFO resulted in: Also try the code I gave in this thread: https://forum.dlang.org/post/fgzvdhkdyevtzznya...@forum.dlang.org In fact, please use this facility i

Re: FIFO

2024-05-13 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
wrote a small performance measurement: put 10,000 things in a FIFO, pull them back out, and loop around that 10,000 times. My FIFO resulted in: real0m1.589s user0m1.585s sys 0m0.004s And the dlist based one: real0m4.731s user0m5.211s sys 0m0.308s Representing the FIFO

Re: FIFO

2024-05-13 Thread Salih Dincer via Digitalmars-d-learn
On Monday, 13 May 2024 at 15:07:39 UTC, Andy Valencia wrote: Representing the FIFO as a linked list clearly has its cost, but I found the increased system time interesting. OS memory allocations maybe? I know you want FIFO, I usually keep this on hand for fixed size LIFO; It can easily

Re: FIFO

2024-05-13 Thread Andy Valencia via Digitalmars-d-learn
On Sunday, 12 May 2024 at 22:03:21 UTC, Ferhat Kurtulmuş wrote: https://dlang.org/phobos/std_container_slist.html This is a stack, isn't it? LIFO? Ahh yes. Then use dlist Thank you. I read its source, and was curious so I wrote a small performance measurement: put 10,000 things in a

Re: FIFO

2024-05-13 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 11 May 2024 at 23:44:28 UTC, Andy Valencia wrote: I need a FIFO for a work scheduler, and nothing suitable jumped out at me. I wrote the following, but as a newbie, would be happy to receive any suggestions or observations. TIA! [...] I don't know your use case, mayb

Re: FIFO

2024-05-12 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 12 May 2024 at 21:08:24 UTC, Andy Valencia wrote: On Sunday, 12 May 2024 at 19:45:44 UTC, Ferhat Kurtulmuş wrote: On Saturday, 11 May 2024 at 23:44:28 UTC, Andy Valencia wrote: I need a FIFO for a work scheduler, and nothing suitable jumped out at me. ... https://dlang.org/phobos

Re: FIFO

2024-05-12 Thread Andy Valencia via Digitalmars-d-learn
On Sunday, 12 May 2024 at 19:45:44 UTC, Ferhat Kurtulmuş wrote: On Saturday, 11 May 2024 at 23:44:28 UTC, Andy Valencia wrote: I need a FIFO for a work scheduler, and nothing suitable jumped out at me. ... https://dlang.org/phobos/std_container_slist.html This is a stack, isn't it?

Re: FIFO

2024-05-12 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 11 May 2024 at 23:44:28 UTC, Andy Valencia wrote: I need a FIFO for a work scheduler, and nothing suitable jumped out at me. I wrote the following, but as a newbie, would be happy to receive any suggestions or observations. TIA! [...] "next" is not a usual range

Re: FIFO

2024-05-12 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 11 May 2024 at 23:44:28 UTC, Andy Valencia wrote: I need a FIFO for a work scheduler, and nothing suitable jumped out at me. I wrote the following, but as a newbie, would be happy to receive any suggestions or observations. TIA! [...] https://dlang.org/phobos

FIFO

2024-05-11 Thread Andy Valencia via Digitalmars-d-learn
I need a FIFO for a work scheduler, and nothing suitable jumped out at me. I wrote the following, but as a newbie, would be happy to receive any suggestions or observations. TIA! /* * fifo.d * FIFO data structure */ module tiny.fifo; import std.exception : enforce; const uint GROWBY

Re: To switch GC from FIFO to LIFO paradigm.

2021-01-15 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Jan 15, 2021 at 08:19:18PM +, tsbockman via Digitalmars-d-learn wrote: [...] > However, generational GCs are somewhat closer to LIFO than what we > have now, which does provide some performance gains under common usage > patterns. People have discussed adding a generational GC to D in

Re: To switch GC from FIFO to LIFO paradigm.

2021-01-15 Thread tsbockman via Digitalmars-d-learn
On Friday, 15 January 2021 at 12:39:30 UTC, MGW wrote: GC cleans memory using the FIFO paradigm. Is it possible to switch GC to work using the LIFO paradigm? As others already said, the current GC isn't FIFO; it just scans everything once in a while a frees whatever it can, new o

Re: To switch GC from FIFO to LIFO paradigm.

2021-01-15 Thread Imperatorn via Digitalmars-d-learn
On Friday, 15 January 2021 at 12:39:30 UTC, MGW wrote: GC cleans memory using the FIFO paradigm. Is it possible to switch GC to work using the LIFO paradigm? AFAIK the GC just sweeps, and the only queue is for destructors (unreachable memory) iirc

Re: To switch GC from FIFO to LIFO paradigm.

2021-01-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/15/21 7:39 AM, MGW wrote: GC cleans memory using the FIFO paradigm. Is it possible to switch GC to work using the LIFO paradigm? I'm not sure what you mean. I don't think there's any guaranteed order for GC cleanup. -Steve

To switch GC from FIFO to LIFO paradigm.

2021-01-15 Thread MGW via Digitalmars-d-learn
GC cleans memory using the FIFO paradigm. Is it possible to switch GC to work using the LIFO paradigm?

Re: Non-blocking reads of a fifo (named pipe)?

2018-12-03 Thread Basile B. via Digitalmars-d-learn
On Monday, 3 December 2018 at 23:32:10 UTC, Anonymouse wrote: I have a fifo that I want to read lines from, but everything is blocking. [...] How can I go about doing this to get non-blocking reads? Or perhaps a way to test whether there is text waiting in the fifo? File.eof is not it

Re: Non-blocking reads of a fifo (named pipe)?

2018-12-03 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Dec 03, 2018 at 11:32:10PM +, Anonymouse via Digitalmars-d-learn wrote: > I have a fifo that I want to read lines from, but everything is > blocking. > > execute([ "mkfifo", filename ]); > File fifo = File(filename, "r"); // blocks alre

Non-blocking reads of a fifo (named pipe)?

2018-12-03 Thread Anonymouse via Digitalmars-d-learn
I have a fifo that I want to read lines from, but everything is blocking. execute([ "mkfifo", filename ]); File fifo = File(filename, "r"); // blocks already immutable input = fifo.readln(); // blocks foreach (line; fifo.byLineCopy) { /* blocks */ } How can I go about d

Re: Deleting a file with extsion *.FIFO in Windows

2018-06-01 Thread Dlang User via Digitalmars-d-learn
On 6/1/2018 12:06 AM, vino.B wrote: On Thursday, 24 May 2018 at 11:31:15 UTC, bauss wrote: On Thursday, 24 May 2018 at 06:59:47 UTC, Vino wrote: Hi All,   Request your help on how to delete a file which has the extension .fifo (.javast.fifo) in Windows. From, Vino.B What exactly is your

Re: Deleting a file with extsion *.FIFO in Windows

2018-05-31 Thread vino.B via Digitalmars-d-learn
On Thursday, 24 May 2018 at 11:31:15 UTC, bauss wrote: On Thursday, 24 May 2018 at 06:59:47 UTC, Vino wrote: Hi All, Request your help on how to delete a file which has the extension .fifo (.javast.fifo) in Windows. From, Vino.B What exactly is your issue with it? Hi Bauss, We have

Re: Deleting a file with extsion *.FIFO in Windows

2018-05-24 Thread bauss via Digitalmars-d-learn
On Thursday, 24 May 2018 at 06:59:47 UTC, Vino wrote: Hi All, Request your help on how to delete a file which has the extension .fifo (.javast.fifo) in Windows. From, Vino.B What exactly is your issue with it?

Deleting a file with extsion *.FIFO in Windows

2018-05-24 Thread Vino via Digitalmars-d-learn
Hi All, Request your help on how to delete a file which has the extension .fifo (.javast.fifo) in Windows. From, Vino.B

Re: FIFO stack

2011-11-05 Thread Marco Leise
Am 26.10.2011, 18:00 Uhr, schrieb Dominic Jones : Also an plain array is a good stack. :) I'd rather not use a plain array because (I assume) that when I push or pop using arrays, a swap array is created to resize the original. If this is not the case, then an array will certainly do. -Dominic

Re: FIFO stack

2011-11-04 Thread Dejan Lekic
Dominic Jones wrote: > Hello, > > I was looking for a FIFO stack in std.containers but only found SList > and Array which both appear to essentially operate as LIFO stacks. Is > there any standard container with which I can push items on to a list, > then later pop them off

Re: FIFO stack

2011-10-28 Thread Jonathan M Davis
On Friday, October 28, 2011 13:24:58 Dominic Jones wrote: > To conclude the matter regarding the absence of a FIFO stack in the > standard library and the not so good alternative of arrays (in > particular where there are a significant number of push-pops and the > maximum length is n

Re: FIFO stack

2011-10-28 Thread Dominic Jones
To conclude the matter regarding the absence of a FIFO stack in the standard library and the not so good alternative of arrays (in particular where there are a significant number of push-pops and the maximum length is not initially known): Does anyone in-the-know know if something like "DLis

Re: FIFO stack

2011-10-27 Thread Nick Sabalausky
"Ary Manzana" wrote in message news:j8buhd$1s80$1...@digitalmars.com... > On 10/27/11 8:38 AM, Nick Sabalausky wrote: >> "Ary Manzana" wrote in message >> news:j89gle$9nn$1...@digitalmars.com... >>> On 10/26/11 1:28 PM, Jonathan M Davis wrote: On Wednesday, October 26, 2011 09:00 Dominic Jo

Re: FIFO stack

2011-10-27 Thread Ary Manzana
On 10/27/11 8:38 AM, Nick Sabalausky wrote: "Ary Manzana" wrote in message news:j89gle$9nn$1...@digitalmars.com... On 10/26/11 1:28 PM, Jonathan M Davis wrote: On Wednesday, October 26, 2011 09:00 Dominic Jones wrote: Also an plain array is a good stack. :) I'd rather not use a plain array

Re: FIFO stack

2011-10-27 Thread Steven Schveighoffer
y is created to resize the original. If this is not the case, then an array will certainly do. -Dominic The matter of using D's arrays as a LIFO is discussed the other branch of this thread (ie, you can do it, but it's slow because a "pop then push" will reallocate and co

Re: FIFO stack

2011-10-27 Thread Christophe
d (ie, you can do it, but it's slow because a "pop then push" will > reallocate and copy), but as far as a FIFO: That may actually be reasonable > to do as an array: > > Decreasing the length of an array (from either end) is a trivial matter that > never allocates

Re: FIFO stack

2011-10-27 Thread Nick Sabalausky
If this is not the case, then an array will certainly do. > -Dominic The matter of using D's arrays as a LIFO is discussed the other branch of this thread (ie, you can do it, but it's slow because a "pop then push" will reallocate and copy), but as far as a FIFO: That ma

Re: FIFO stack

2011-10-27 Thread Nick Sabalausky
"Ary Manzana" wrote in message news:j89gle$9nn$1...@digitalmars.com... > On 10/26/11 1:28 PM, Jonathan M Davis wrote: >> On Wednesday, October 26, 2011 09:00 Dominic Jones wrote: Also an plain array is a good stack. :) >>> >>> I'd rather not use a plain array because (I assume) that when I p

Re: FIFO stack

2011-10-26 Thread Timon Gehr
On 10/26/2011 07:38 PM, Ary Manzana wrote: On 10/26/11 1:28 PM, Jonathan M Davis wrote: On Wednesday, October 26, 2011 09:00 Dominic Jones wrote: Also an plain array is a good stack. :) I'd rather not use a plain array because (I assume) that when I push or pop using arrays, a swap array is c

Re: FIFO stack

2011-10-26 Thread Jesse Phillips
Ary Manzana Wrote: > On 10/26/11 1:28 PM, Jonathan M Davis wrote: > > Not exactly. If you want to know more about how arrays work, you should read > > this: http://www.dsource.org/projects/dcollections/wiki/ArrayArticle It's a > > great read. As for using an array as a stack, you can do it with a

Re: FIFO stack

2011-10-26 Thread Jonathan M Davis
On Wednesday, October 26, 2011 10:38 Ary Manzana wrote: > On 10/26/11 1:28 PM, Jonathan M Davis wrote: > > On Wednesday, October 26, 2011 09:00 Dominic Jones wrote: > >>> Also an plain array is a good stack. :) > >> > >> I'd rather not use a plain array because (I assume) that when I push > >> or

Re: FIFO stack

2011-10-26 Thread Ary Manzana
On 10/26/11 1:28 PM, Jonathan M Davis wrote: On Wednesday, October 26, 2011 09:00 Dominic Jones wrote: Also an plain array is a good stack. :) I'd rather not use a plain array because (I assume) that when I push or pop using arrays, a swap array is created to resize the original. If this is no

Re: FIFO stack

2011-10-26 Thread Jonathan M Davis
On Wednesday, October 26, 2011 09:00 Dominic Jones wrote: > > Also an plain array is a good stack. :) > > I'd rather not use a plain array because (I assume) that when I push > or pop using arrays, a swap array is created to resize the original. > If this is not the case, then an array will certai

Re: FIFO stack

2011-10-26 Thread Dominic Jones
> Also an plain array is a good stack. :) I'd rather not use a plain array because (I assume) that when I push or pop using arrays, a swap array is created to resize the original. If this is not the case, then an array will certainly do. -Dominic

Re: FIFO stack

2011-10-26 Thread Marco Leise
Am 26.10.2011, 17:20 Uhr, schrieb Simen Kjaeraas : On Wed, 26 Oct 2011 17:15:37 +0200, Simen Kjaeraas wrote: On Wed, 26 Oct 2011 10:58:12 +0200, Dominic Jones wrote: Hello, I was looking for a FIFO stack in std.containers but only found SList and Array which both appear to

Re: FIFO stack

2011-10-26 Thread Simen Kjaeraas
On Wed, 26 Oct 2011 17:15:37 +0200, Simen Kjaeraas wrote: On Wed, 26 Oct 2011 10:58:12 +0200, Dominic Jones wrote: Hello, I was looking for a FIFO stack in std.containers but only found SList and Array which both appear to essentially operate as LIFO stacks. Is there any standard

Re: FIFO stack

2011-10-26 Thread Simen Kjaeraas
On Wed, 26 Oct 2011 10:58:12 +0200, Dominic Jones wrote: Hello, I was looking for a FIFO stack in std.containers but only found SList and Array which both appear to essentially operate as LIFO stacks. Is there any standard container with which I can push items on to a list, then later pop

Re: FIFO stack

2011-10-26 Thread Jonathan M Davis
On Wednesday, October 26, 2011 08:58:12 Dominic Jones wrote: > Hello, > > I was looking for a FIFO stack in std.containers but only found SList > and Array which both appear to essentially operate as LIFO stacks. Is > there any standard container with which I can push items on to

FIFO stack

2011-10-26 Thread Dominic Jones
Hello, I was looking for a FIFO stack in std.containers but only found SList and Array which both appear to essentially operate as LIFO stacks. Is there any standard container with which I can push items on to a list, then later pop them off from the bottom of that list? If so, then how? Thank