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

2015-08-21 Thread Russel Winder via Digitalmars-d-learn
On Thu, 2015-08-20 at 20:01 +, tony288 via Digitalmars-d-learn wrote: > […] > Now what I would like to know, how would I make this code more > efficient? Which is basically the aim I'm trying to achieve. > > Any pointers would be really help full. Should I use > concurrency/parallelism etc.

Re: post on using go 1.5 and GC latency

2015-08-21 Thread via Digitalmars-d-learn
On Saturday, 22 August 2015 at 06:48:48 UTC, Russel Winder wrote: But one that Google are entirely happy to fully fund. Yes, they have made Go fully supported on Google Cloud now, so I think it is safe to say that Google management is backing Go fully. I'm kinda hoping for Go++...

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

2015-08-21 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2015-08-21 at 01:22 +, Nicholas Wilson via Digitalmars-d -learn wrote: > […] > Keep in mind java may be using green threads as opposed to kernel > threads. > The equivalent in D is a Fiber. I believe Java itself hasn't used green threads in an awful long time: Threads are mapped to k

Re: post on using go 1.5 and GC latency

2015-08-21 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2015-08-21 at 10:47 +, via Digitalmars-d-learn wrote: > 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/1kBx98ulj5V5M9Zdeamy7v6ofZXX3yPziA > f0V27A64

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 multi

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 I

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: 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 experiments:

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: 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 I

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 ti

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 single

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, bef

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 mutable/const/immutable

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 ref

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 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.

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 g

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 thank

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 wrote

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: 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 th

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 direct

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: https://github.c

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: 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 time

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: https://github.com/D-Programming-Language/phobos/blob/master/std/concurre

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: share

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, D

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: 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 I'm