Re: most elegant functional way to make a histogram

2015-08-21 Thread Meta via Digitalmars-d-learn
On Saturday, 22 August 2015 at 02:12:41 UTC, BBasile wrote: On Friday, 21 August 2015 at 20:09:22 UTC, Laeeth Isharc wrote: I have four arrays of ints, each array representing a kind of event associated with that int (they all map to the same space). Each array might have the same number

Re: flush MessageBox

2015-08-21 Thread Chris via Digitalmars-d-learn
On Thursday, 20 August 2015 at 15:57:47 UTC, John Colvin wrote: On Thursday, 20 August 2015 at 15:25:57 UTC, Chris wrote: Is there a way to flush a thread's message box other than aborting the thread? MailBox is private:

Re: post on using go 1.5 and GC latency

2015-08-21 Thread via Digitalmars-d-learn
Yes, Go has sacrificed some compute performance in favour of latency and convenience. They have also released GC improvement plans for 1.6: https://docs.google.com/document/d/1kBx98ulj5V5M9Zdeamy7v6ofZXX3yPziAf0V27A64Mo/edit It is rather obvious that a building a good concurrent GC is a

controlling source directory of -cov

2015-08-21 Thread Steven Schveighoffer via Digitalmars-d-learn
Currently, -cov requires you to run the coverage-instrumented program in the directory you compiled, so that it can find the source. Is there a way to tell the instrumented program where the source is if you run it in another directory? Alternatively, is there a way to specify the output

Re: New to D - playing with Thread and false Sharing

2015-08-21 Thread Kagamin via Digitalmars-d-learn
On Thursday, 20 August 2015 at 15:31:13 UTC, tony288 wrote: So I wrong some code. But it seems the time to process a shared struct shared long is always the same. Regardless of adding paddings. Should it be different?

Re: flush MessageBox

2015-08-21 Thread Chris via Digitalmars-d-learn
On Friday, 21 August 2015 at 12:59:09 UTC, John Colvin wrote: On Friday, 21 August 2015 at 10:43:22 UTC, Chris wrote: On Thursday, 20 August 2015 at 15:57:47 UTC, John Colvin wrote: On Thursday, 20 August 2015 at 15:25:57 UTC, Chris wrote: Is there a way to flush a thread's message box other

Re: flush MessageBox

2015-08-21 Thread John Colvin via Digitalmars-d-learn
On Friday, 21 August 2015 at 10:43:22 UTC, Chris wrote: On Thursday, 20 August 2015 at 15:57:47 UTC, John Colvin wrote: On Thursday, 20 August 2015 at 15:25:57 UTC, Chris wrote: Is there a way to flush a thread's message box other than aborting the thread? MailBox is private:

const-correct structs, best practices?

2015-08-21 Thread Nick Sabalausky via Digitalmars-d-learn
Is there a good posting somewhere that summarizes the current best practices for making const-correct (ie works for all of mutable/const/immutable) structs?

Re: New to D - playing with Thread and false Sharing

2015-08-21 Thread tony288 via Digitalmars-d-learn
On Friday, 21 August 2015 at 12:45:52 UTC, Kagamin wrote: On Thursday, 20 August 2015 at 15:31:13 UTC, tony288 wrote: So I wrong some code. But it seems the time to process a shared struct shared long is always the same. Regardless of adding paddings. Should it be different? Hi all

Re: const-correct structs, best practices?

2015-08-21 Thread Nick Sabalausky via Digitalmars-d-learn
On 08/21/2015 12:22 PM, Dicebot wrote: On Friday, 21 August 2015 at 15:00:04 UTC, Nick Sabalausky wrote: Is there a good posting somewhere that summarizes the current best practices for making const-correct (ie works for all of mutable/const/immutable) structs? - mark methods const - avoid

Best nogc method to insert element into the middle of an std.container Array?

2015-08-21 Thread Red Frog via Digitalmars-d-learn
I know inserting into the middle of arrays isn't the most efficient thing to do, but I have my reasons... I could increase the length by 1 and then shuffle all the values back one at a time... but I assume it'd be better to rewrite the back half as a single chunk? I don't really know how to

Re: const-correct structs, best practices?

2015-08-21 Thread Meta via Digitalmars-d-learn
On Friday, 21 August 2015 at 15:00:04 UTC, Nick Sabalausky wrote: Is there a good posting somewhere that summarizes the current best practices for making const-correct (ie works for all of mutable/const/immutable) structs? Prepare for pain.

Re: flush MessageBox

2015-08-21 Thread Chris via Digitalmars-d-learn
On Friday, 21 August 2015 at 14:35:53 UTC, Chris wrote: On Friday, 21 August 2015 at 12:59:09 UTC, John Colvin wrote: On Friday, 21 August 2015 at 10:43:22 UTC, Chris wrote: On Thursday, 20 August 2015 at 15:57:47 UTC, John Colvin wrote: On Thursday, 20 August 2015 at 15:25:57 UTC, Chris

Re: const-correct structs, best practices?

2015-08-21 Thread Dicebot via Digitalmars-d-learn
On Friday, 21 August 2015 at 15:00:04 UTC, Nick Sabalausky wrote: Is there a good posting somewhere that summarizes the current best practices for making const-correct (ie works for all of mutable/const/immutable) structs? - mark methods const - avoid reference type fields ;)

Re: const-correct structs, best practices?

2015-08-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/21/15 12:31 PM, Nick Sabalausky wrote: On 08/21/2015 12:22 PM, Dicebot wrote: On Friday, 21 August 2015 at 15:00:04 UTC, Nick Sabalausky wrote: Is there a good posting somewhere that summarizes the current best practices for making const-correct (ie works for all of

most elegant functional way to make a histogram

2015-08-21 Thread Laeeth Isharc via Digitalmars-d-learn
I have four arrays of ints, each array representing a kind of event associated with that int (they all map to the same space). Each array might have the same number multiple times and each array will be of different length. So I would like to plot the int line on x axis and show number of

Re: most elegant functional way to make a histogram

2015-08-21 Thread Laeeth Isharc via Digitalmars-d-learn
On Friday, 21 August 2015 at 20:09:22 UTC, Laeeth Isharc wrote: I have four arrays of ints, each array representing a kind of event associated with that int (they all map to the same space). Each array might have the same number multiple times and each array will be of different length. So

Re: flush MessageBox

2015-08-21 Thread John Colvin via Digitalmars-d-learn
On Friday, 21 August 2015 at 14:35:53 UTC, Chris wrote: On Friday, 21 August 2015 at 12:59:09 UTC, John Colvin wrote: [...] Wouldn't it be easier to have a library function that can empty the mailbox immediately? It's a waste of time to have all items in the mailbox crash against a wall,

Re: Best nogc method to insert element into the middle of an std.container Array?

2015-08-21 Thread Ali Çehreli via Digitalmars-d-learn
On 08/21/2015 08:51 AM, Red Frog wrote: I know inserting into the middle of arrays isn't the most efficient thing to do, but I have my reasons... I could increase the length by 1 and then shuffle all the values back one at a time... but I assume it'd be better to rewrite the back half as a

Appender at CTFE?

2015-08-21 Thread Nick Sabalausky via Digitalmars-d-learn
Not at a pc, so can't test right now, but does Appender work at compile time? If not, does ~= still blow up CTFE memory usage like it used to? Any other best practice / trick for building strings in CTFE?

Re: Appender at CTFE?

2015-08-21 Thread cym13 via Digitalmars-d-learn
On Friday, 21 August 2015 at 22:39:29 UTC, Nick Sabalausky wrote: Not at a pc, so can't test right now, but does Appender work at compile time? If not, does ~= still blow up CTFE memory usage like it used to? Any other best practice / trick for building strings in CTFE? I did two

Re: most elegant functional way to make a histogram

2015-08-21 Thread BBasile via Digitalmars-d-learn
On Friday, 21 August 2015 at 20:09:22 UTC, Laeeth Isharc wrote: I have four arrays of ints, each array representing a kind of event associated with that int (they all map to the same space). Each array might have the same number multiple times and each array will be of different length. So

Re: Appender at CTFE?

2015-08-21 Thread Nick Sabalausky via Digitalmars-d-learn
Thanks! I wouldn't have expected that about the memory. But I wonder how much of that memory usage with Appender was just all the template instantiations. I'll have to look into that when I get back.

Re: GC and MMM

2015-08-21 Thread thedeemon via Digitalmars-d-learn
On Thursday, 20 August 2015 at 17:13:33 UTC, Ilya Yaroshenko wrote: Hi All! Does GC scan manually allocated memory? Only if you ask GC to do it - by calling core.memory.addRange.

Re: Why does not my program is not running?

2015-08-21 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Thursday, 20 August 2015 at 21:15:36 UTC, anonymous2 wrote: On Thursday, 20 August 2015 at 21:11:07 UTC, anonymous wrote: I severely limited the range of integer. I don't know off the top of my head how large you can make it without hitting overflow. I removed the file writing, because

main() return code.

2015-08-21 Thread Tony via Digitalmars-d-learn
Why is it acceptable to specify main as returning void (in addition to returning int)?

Re: main() return code.

2015-08-21 Thread Ali Çehreli via Digitalmars-d-learn
On 08/21/2015 01:49 AM, Tony wrote: Why is it acceptable to specify main as returning void (in addition to returning int)? void in that context means automatically return 0 if main() exits without exception and non-zero if it exits with exception. Ali

post on using go 1.5 and GC latency

2015-08-21 Thread Laeeth Isharc via Digitalmars-d-learn
https://medium.com/@robin.verlangen/billions-of-request-per-day-meet-go-1-5-362bfefa0911 We then started analyzing the behavior of our Go application. On average the application spent ~ 2ms per request, which was great! It gave us 98 milliseconds to spare for network overhead, SSL handshake,

Re: New to D - playing with Thread and false Sharing

2015-08-21 Thread John Colvin via Digitalmars-d-learn
On Friday, 21 August 2015 at 02:44:50 UTC, Rikki Cattermole wrote: On 8/21/2015 3:37 AM, Dejan Lekic wrote: Keep in mind that in D everything is thread-local by default! :) For shared resources use __gshared or shared (although I do not know for sure whether shared works or not). Note: