Re: problem with parallel foreach

2015-05-13 Thread Gerald Jansen via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 03:19:17 UTC, thedeemon wrote: In case of Python's parallel.Pool() separate processes do the work without any synchronization issues. In case of D's std.parallelism it's just threads inside one process and they do fight for some locks, thus this result. Okay, so

Re: Accessing x86 Performance Counters

2015-05-13 Thread Dmitri Makarov via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 03:38:33 UTC, Maxime Chevalier-Boisvert wrote: I was wondering if anyone has written D code to access the x86 performance counters, to get information such as the number of cache misses and cycle count. Intel made available the source of their performance counter

Re: Accessing x86 Performance Counters

2015-05-13 Thread Kagamin via Digitalmars-d-learn
There was no word about windows, but process explorer shows page faults and cycles per process from unprivileged account, so I guess, this information is available through some API. Not sure is such system-wide statistics is available too.

Re: Accessing x86 Performance Counters

2015-05-13 Thread via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 03:38:33 UTC, Maxime Chevalier-Boisvert wrote: I was wondering if anyone has written D code to access the x86 performance counters, to get information such as the number of cache misses and cycle count. For linux, you could try:

Re: Accessing x86 Performance Counters

2015-05-13 Thread Benjamin Thaut via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 08:53:10 UTC, Kagamin wrote: There was no word about windows, but process explorer shows page faults and cycles per process from unprivileged account, so I guess, this information is available through some API. Not sure is such system-wide statistics is available

Contract programing restrictions

2015-05-13 Thread iackhtak via Digitalmars-d-learn
There was discussion about broken contract programing. Broken thing was in contract within inheritance. If you add different in-contract in overridden parent and derived function only one will be checked. I thought that solution is to ban in-contract for derived function. In-contract says what

Re: Clean way to tell whether a destructor is called by the GC

2015-05-13 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 12 May 2015 at 12:53:59 UTC, ponce wrote: I already have such a dispose() function. The problem is that to support Unique! and scoped! and friends, the destructor must call dispose(). Thus my need for a way to separate the GC-induced destructors within dispose() or ~this (same

Re: Contract programing restrictions

2015-05-13 Thread iackhtak via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 10:18:26 UTC, iackhtak wrote: There was discussion about broken contract programing. Broken thing was in contract within inheritance. If you add different in-contract in overridden parent and derived function only one will be checked. I thought that solution is to

Re: problem with parallel foreach

2015-05-13 Thread Rikki Cattermole via Digitalmars-d-learn
On 13/05/2015 2:59 a.m., Gerald Jansen wrote: I am a data analyst trying to learn enough D to decide whether to use D for a new project rather than Python + Fortran. I have recoded a non-trivial Python program to do some simple parallel data processing (using the map function in Python's

Re: Accessing x86 Performance Counters

2015-05-13 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 03:38:33 UTC, Maxime Chevalier-Boisvert wrote: I was wondering if anyone has written D code to access the x86 performance counters, to get information such as the number of cache misses and cycle count. It would probably be easiest to write some bindings to PAPI-C

Re: problem with parallel foreach

2015-05-13 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 12 May 2015 at 18:14:56 UTC, Gerald Jansen wrote: On Tuesday, 12 May 2015 at 16:35:23 UTC, Rikki Cattermole wrote: On 13/05/2015 4:20 a.m., Gerald Jansen wrote: At the risk of great embarassment ... here's my program: http://dekoppel.eu/tmp/pedupg.d Would it be possible to give

Re: problem with parallel foreach

2015-05-13 Thread weaselcat via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 09:01:05 UTC, Gerald Jansen wrote: On Wednesday, 13 May 2015 at 03:19:17 UTC, thedeemon wrote: In case of Python's parallel.Pool() separate processes do the work without any synchronization issues. In case of D's std.parallelism it's just threads inside one process

Re: problem with parallel foreach

2015-05-13 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 11:33:55 UTC, John Colvin wrote: On Tuesday, 12 May 2015 at 18:14:56 UTC, Gerald Jansen wrote: On Tuesday, 12 May 2015 at 16:35:23 UTC, Rikki Cattermole wrote: On 13/05/2015 4:20 a.m., Gerald Jansen wrote: At the risk of great embarassment ... here's my program:

Re: problem with parallel foreach

2015-05-13 Thread Gerald Jansen via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 11:33:55 UTC, John Colvin wrote: On Tuesday, 12 May 2015 at 18:14:56 UTC, Gerald Jansen wrote: On Tuesday, 12 May 2015 at 16:35:23 UTC, Rikki Cattermole wrote: On 13/05/2015 4:20 a.m., Gerald Jansen wrote: At the risk of great embarassment ... here's my program:

Re: problem with parallel foreach

2015-05-13 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 14:28:52 UTC, Gerald Jansen wrote: On Wednesday, 13 May 2015 at 13:40:33 UTC, John Colvin wrote: On Wednesday, 13 May 2015 at 11:33:55 UTC, John Colvin wrote: On Tuesday, 12 May 2015 at 18:14:56 UTC, Gerald Jansen wrote: On Tuesday, 12 May 2015 at 16:35:23 UTC,

Re: problem with parallel foreach

2015-05-13 Thread Gerald Jansen via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 14:11:25 UTC, Gerald Jansen wrote: On Wednesday, 13 May 2015 at 11:33:55 UTC, John Colvin wrote: On Tuesday, 12 May 2015 at 18:14:56 UTC, Gerald Jansen wrote: On Tuesday, 12 May 2015 at 16:35:23 UTC, Rikki Cattermole wrote: On 13/05/2015 4:20 a.m., Gerald Jansen

Re: problem with parallel foreach

2015-05-13 Thread Gerald Jansen via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 13:40:33 UTC, John Colvin wrote: On Wednesday, 13 May 2015 at 11:33:55 UTC, John Colvin wrote: On Tuesday, 12 May 2015 at 18:14:56 UTC, Gerald Jansen wrote: On Tuesday, 12 May 2015 at 16:35:23 UTC, Rikki Cattermole wrote: On 13/05/2015 4:20 a.m., Gerald Jansen

Re: problem with parallel foreach

2015-05-13 Thread Gerald Jansen via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 12:16:19 UTC, weaselcat wrote: On Wednesday, 13 May 2015 at 09:01:05 UTC, Gerald Jansen wrote: On Wednesday, 13 May 2015 at 03:19:17 UTC, thedeemon wrote: In case of Python's parallel.Pool() separate processes do the work without any synchronization issues. In case

Re: Feature or bug: print braces

2015-05-13 Thread Brian Schott via Digitalmars-d-learn
On Thursday, 14 May 2015 at 00:29:06 UTC, Dennis Ritchie wrote: Why doesn't the compiler produces an error? - import std.stdio; void main() { writeln({}); } - http://ideone.com/qTZCAd You told it to output a function literal, so it did. (That or you told it to output a

Re: Feature or bug: print braces

2015-05-13 Thread Dennis Ritchie via Digitalmars-d-learn
Turns out that I can put into the function writeln almost any design language: - import std.stdio; void main() { writeln( { int n = 5; } ); } - http://ideone.com/Rp7gZ2

Re: Feature or bug: print braces

2015-05-13 Thread Dennis Ritchie via Digitalmars-d-learn
On Thursday, 14 May 2015 at 00:33:33 UTC, Brian Schott wrote: You told it to output a function literal, so it did. Yes, but it would be logical to deduce something like: - writeln({}); // prints literal[{}] Or the compiler will not be able to distinguish the literal from the ordinary

Returning an empty range of a given type

2015-05-13 Thread rcorre via Digitalmars-d-learn
I've run into this situation a lot: I have a function that returns a range (in this case, a slice of a custom container). In some cases, the function needs to return an empty range. It sounded like takeNone was what I wanted: @nogc auto fun() { return (some_condition) ? getRange() :

dmd Regression(?): bigEndianToNative buffer slice allows only literals

2015-05-13 Thread Lucas Burson via Digitalmars-d-learn
The std.batmanip bigEndianToNative has a regression where the slice range doesn't work with variables (only literals). Is the syntax incorrect or is this a regression in dmd? Using this main.d: import std.bitmanip; int main(string args[]) { auto datain = new ubyte[16]; // this syntax

Re: Returning an empty range of a given type

2015-05-13 Thread rcorre via Digitalmars-d-learn
Actually, this doesn't even seem to work with a custom range: import std.range; import std.stdio; import std.algorithm; struct MyContainer { @nogc auto opSlice() { struct Range { @property bool empty() { return true; } @property int front() { return 9; }

Feature or bug: print braces

2015-05-13 Thread Dennis Ritchie via Digitalmars-d-learn
Why doesn't the compiler produces an error? - import std.stdio; void main() { writeln({}); } - http://ideone.com/qTZCAd

Re: dmd Regression(?): bigEndianToNative buffer slice allows only literals

2015-05-13 Thread Lucas Burson via Digitalmars-d-learn
I reported this as a regression https://issues.dlang.org/show_bug.cgi?id=14582

Re: Returning an empty range of a given type

2015-05-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, May 14, 2015 02:47:22 rcorre via Digitalmars-d-learn wrote: I've run into this situation a lot: I have a function that returns a range (in this case, a slice of a custom container). In some cases, the function needs to return an empty range. It sounded like takeNone was what I

Re: Accessing x86 Performance Counters

2015-05-13 Thread CraigDillabaugh via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 09:26:40 UTC, Benjamin Thaut wrote: On Wednesday, 13 May 2015 at 08:53:10 UTC, Kagamin wrote: There was no word about windows, but process explorer shows page faults and cycles per process from unprivileged account, so I guess, this information is available through

Re: problem with parallel foreach

2015-05-13 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 14:43:50 UTC, John Colvin wrote: On Wednesday, 13 May 2015 at 14:28:52 UTC, Gerald Jansen wrote: On Wednesday, 13 May 2015 at 13:40:33 UTC, John Colvin wrote: On Wednesday, 13 May 2015 at 11:33:55 UTC, John Colvin wrote: On Tuesday, 12 May 2015 at 18:14:56 UTC,

Re: problem with parallel foreach

2015-05-13 Thread Ali Çehreli via Digitalmars-d-learn
On 05/12/2015 08:19 PM, thedeemon wrote: In case of Python's parallel.Pool() separate processes do the work without any synchronization issues. In case of D's std.parallelism it's just threads inside one process and they do fight for some locks, thus this result. Right. To do the same in D,

Re: pthread and GC

2015-05-13 Thread Dicebot via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 07:04:39 UTC, tcak wrote: I am using pthread somewhere in program, and it creates an object. After a while, I see core.thread.scanAllTypeImpl error on gdb. Does this mean that pthread and GC are incompatible? Any solution without making too much code changes?

Re: Accessing x86 Performance Counters

2015-05-13 Thread Benjamin Thaut via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 03:38:33 UTC, Maxime Chevalier-Boisvert wrote: I was wondering if anyone has written D code to access the x86 performance counters, to get information such as the number of cache misses and cycle count. I considered doing that at one point. So I looked for

pthread and GC

2015-05-13 Thread tcak via Digitalmars-d-learn
I am using pthread somewhere in program, and it creates an object. After a while, I see core.thread.scanAllTypeImpl error on gdb. Does this mean that pthread and GC are incompatible? Any solution without making too much code changes?

Re: problem with parallel foreach

2015-05-13 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 06:59:02 UTC, Ali Çehreli wrote: In case of Python's parallel.Pool() separate processes do the work without any synchronization issues. In case of D's std.parallelism it's just threads inside one process and they do fight for some locks, thus this result. Right.

Re: pthread and GC

2015-05-13 Thread tcak via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 07:29:51 UTC, Dicebot wrote: On Wednesday, 13 May 2015 at 07:04:39 UTC, tcak wrote: I am using pthread somewhere in program, and it creates an object. After a while, I see core.thread.scanAllTypeImpl error on gdb. Does this mean that pthread and GC are

Re: Run-time Indexing of a Compile-Time Tuple

2015-05-13 Thread Jakob Ovrum via Digitalmars-d-learn
On Tuesday, 12 May 2015 at 13:30:22 UTC, Idan Arye wrote: A little hacky, but how about casting it to a static array? http://dpaste.dzfl.pl/d0059e6e6c09 This PR[1] achieves this without making a copy. [1] https://github.com/D-Programming-Language/phobos/pull/3198