How to get output of piped process?

2021-02-16 Thread Jedi via Digitalmars-d-learn
I an using pipeShell, I have redirected stdout, stderr, and stdin. I am trying to read from the output and display it in my app. I have followed this code almost exactly except I use try wait and flush because the app is continuously updating the output. (it outputs a progress text on the

Re: Trying to reduce memory usage

2021-02-16 Thread tsbockman via Digitalmars-d-learn
On Wednesday, 17 February 2021 at 04:10:24 UTC, tsbockman wrote: On files small enough to fit in RAM, it is similar in speed to the other solutions posted, but less memory hungry. Memory consumption in this case is around (sourceFile.length + 32 * lineCount * 3 / 2) bytes. Run time is similar

Re: Trying to reduce memory usage

2021-02-16 Thread tsbockman via Digitalmars-d-learn
On Friday, 12 February 2021 at 01:23:14 UTC, Josh wrote: I'm trying to read in a text file that has many duplicated lines and output a file with all the duplicates removed. By the end of this code snippet, the memory usage is ~5x the size of the infile (which can be multiple GB each), and when

Re: is it posible to compile individual module separately?

2021-02-16 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 16 February 2021 at 17:49:42 UTC, Anonymouse wrote: On Tuesday, 16 February 2021 at 17:26:06 UTC, Paul Backus wrote: On Tuesday, 16 February 2021 at 17:15:25 UTC, Anonymouse wrote: You can also use dub build --build-mode=singleFile, and it will compile one file at a time. It'll be

Re: is it posible to compile individual module separately?

2021-02-16 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 16 February 2021 at 17:26:06 UTC, Paul Backus wrote: On Tuesday, 16 February 2021 at 17:15:25 UTC, Anonymouse wrote: You can also use dub build --build-mode=singleFile, and it will compile one file at a time. It'll be slow but slow is better than OOM. singleFile is for

Re: is it posible to compile individual module separately?

2021-02-16 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 16 February 2021 at 17:15:25 UTC, Anonymouse wrote: You can also use dub build --build-mode=singleFile, and it will compile one file at a time. It'll be slow but slow is better than OOM. singleFile is for single-file packages [1]. The option you're thinking of is

Re: is it posible to compile individual module separately?

2021-02-16 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 16 February 2021 at 17:06:21 UTC, evilrat wrote: On Tuesday, 16 February 2021 at 07:01:53 UTC, bokuno_D wrote: i run "dub build" on it. but OOM kill the compiler. - is there a way to reduce memory consumtion of the compiler? or maybe third party tool? alternative to dub? Assuming

Re: is it posible to compile individual module separately?

2021-02-16 Thread evilrat via Digitalmars-d-learn
On Tuesday, 16 February 2021 at 07:01:53 UTC, bokuno_D wrote: i run "dub build" on it. but OOM kill the compiler. - is there a way to reduce memory consumtion of the compiler? or maybe third party tool? alternative to dub? Assuming you are using DMD, there is -lowmem switch to enable garbage

Re: Fastest way to "ignore" elements from array without removal

2021-02-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/16/21 1:03 AM, H. S. Teoh wrote: For the former, you can use the read-head/write-head algorithm: keep two indices as you iterate over the array, say i and j: i is for reading (incremented every iteration) and j is for writing (not incremented if array[i] is to be deleted). Each iteration,

Re: Fastest way to "ignore" elements from array without removal

2021-02-16 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 16 February 2021 at 09:08:33 UTC, z wrote: Does filter support multiple arguments for the predicate?(i.e. using a function that has a "bool function(T1 a, T2 b)" prototype) I am not sure exactly what you are asking here, but you can probably accomplish what you want by combining

Re: Constructor called instead of opAssign()

2021-02-16 Thread frame via Digitalmars-d-learn
On Tuesday, 16 February 2021 at 09:04:43 UTC, Boris Carvajal wrote: I don't think this is intended rather it appears to be a bug/deficiency in the constructor flow analysis of DMD, which from what I'm reading is very rudimentary. If I'm using a delegate in B, supplied to super() and called

Re: Fastest way to "ignore" elements from array without removal

2021-02-16 Thread z via Digitalmars-d-learn
On Tuesday, 16 February 2021 at 06:03:50 UTC, H. S. Teoh wrote: It depends on what your goal is. Do you want to permanently remove the items from the array? Or only skip over some items while iterating over it? For the latter, see std.algorithm.iteration.filter. The array itself is read

Re: Fastest way to "ignore" elements from array without removal

2021-02-16 Thread z via Digitalmars-d-learn
On Tuesday, 16 February 2021 at 04:43:33 UTC, Paul Backus wrote: On Tuesday, 16 February 2021 at 04:20:06 UTC, z wrote: What would be the overall best manner(in ease of implementation and speed) to arbitrarily remove an item in the middle of an array while iterating through it?

Re: Constructor called instead of opAssign()

2021-02-16 Thread Boris Carvajal via Digitalmars-d-learn
On Sunday, 14 February 2021 at 08:46:34 UTC, frame wrote: The first instance is in A - and why opAssign then works there? Sorry I didn't pay too much attention. It seems the detection of first assignment only happens when the field and constructor have the same parent, so it doesn't work