Re: multithread/concurrency/parallel methods and performance

2018-02-19 Thread Dmitry Olshansky via Digitalmars-d-learn
On Monday, 19 February 2018 at 14:57:22 UTC, SrMordred wrote: On Monday, 19 February 2018 at 05:54:53 UTC, Dmitry Olshansky wrote: The operation is trivial and dataset is rather small. In such cases SIMD with eg array ops is the way to go: result[] = values[] * values2[]; Yes, absolutely righ

Re: Building from source on FreeBSD

2018-02-19 Thread psychoticRabbit via Digitalmars-d-learn
On Monday, 19 February 2018 at 12:01:31 UTC, Jonathan M Davis wrote: I've never been able to figure this problem out, so I've I always just edited the makefile so that the two programs in CURL_TOOLS aren't built. IIRC, if you use -v to see the full linker command, it's even actually linking to

Re: std.traits.isBoolean

2018-02-19 Thread Tony via Digitalmars-d-learn
On Monday, 19 February 2018 at 17:22:04 UTC, Nathan S. wrote: On Monday, 19 February 2018 at 15:12:15 UTC, Tony wrote: But, assuming there is a use case for it, what if you want to restrict to a type that is either boolean, or a struct/class that can substitute for boolean - how do you do that

Re: Could that bug be catch using D's way?

2018-02-19 Thread Ali Çehreli via Digitalmars-d-learn
On 02/19/2018 05:33 AM, rikki cattermole wrote: https://dlang.org/phobos/std_experimental_checkedint.html#.Checked.min Accompanying presentations: DConf 2017: https://www.youtube.com/watch?v=29h6jGtZD-U Google Tel Aviv: https://www.youtube.com/watch?v=es6U7WAlKpQ Andrei likes the second

Re: Could that bug be catch using D's way?

2018-02-19 Thread Basile B. via Digitalmars-d-learn
On Monday, 19 February 2018 at 21:34:04 UTC, Simen Kjærås wrote: On Monday, 19 February 2018 at 14:20:16 UTC, Basile B. wrote: I had never used Checked and i discover that strangely there's no hook for opAssign. onLowerBound and onUpperBound works for +=, -=, *=, /=, %=, ^^=, &=, |=, ^=, <<=, >

Re: Could that bug be catch using D's way?

2018-02-19 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 19 February 2018 at 14:20:16 UTC, Basile B. wrote: I had never used Checked and i discover that strangely there's no hook for opAssign. onLowerBound and onUpperBound works for +=, -=, *=, /=, %=, ^^=, &=, |=, ^=, <<=, >>=, and >>>=. But since init is 0, += works: Ah, thanks. Filed

Re: Building from source on FreeBSD

2018-02-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, February 19, 2018 14:41:21 Seb via Digitalmars-d-learn wrote: > On Monday, 19 February 2018 at 12:01:31 UTC, Jonathan M Davis > > wrote: > > On Monday, February 19, 2018 11:43:26 psychoticRabbit via > > > > Digitalmars-d- learn wrote: > >> [...] > > > > I've never been able to figure thi

Re: std.traits.isBoolean

2018-02-19 Thread Nathan S. via Digitalmars-d-learn
On Monday, 19 February 2018 at 15:12:15 UTC, Tony wrote: But, assuming there is a use case for it, what if you want to restrict to a type that is either boolean, or a struct/class that can substitute for boolean - how do you do that without using the "private" TypeOfBoolean thing? In that ca

Re: std.traits.isBoolean

2018-02-19 Thread Tony via Digitalmars-d-learn
On Monday, 19 February 2018 at 13:47:15 UTC, Basile B. wrote: Indeed but Phobos maintainers don't want the ...TypeOf family to be documented. (https://github.com/dlang/phobos/pull/5747) Ok, thanks. But, assuming there is a use case for it, what if you want to restrict to a type that is ei

Re: How to make AA key a pointer

2018-02-19 Thread ketmar via Digitalmars-d-learn
Clinton wrote: On Monday, 19 February 2018 at 14:55:01 UTC, Clinton wrote: Hi all, I need advice from better developers on this concern. I'm using an AA to reference another array for quicker access: [...] Sorry, on second look my explanation isn't very clear. I want to know if: bool[strin

Re: How to make AA key a pointer

2018-02-19 Thread Rene Zwanenburg via Digitalmars-d-learn
On Monday, 19 February 2018 at 14:57:47 UTC, Clinton wrote: On Monday, 19 February 2018 at 14:55:01 UTC, Clinton wrote: Hi all, I need advice from better developers on this concern. I'm using an AA to reference another array for quicker access: [...] Sorry, on second look my explanation isn'

Re: How to make AA key a pointer

2018-02-19 Thread Clinton via Digitalmars-d-learn
On Monday, 19 February 2018 at 14:55:01 UTC, Clinton wrote: Hi all, I need advice from better developers on this concern. I'm using an AA to reference another array for quicker access: [...] Sorry, on second look my explanation isn't very clear. I want to know if: bool[string] myAA; myAA[

Re: multithread/concurrency/parallel methods and performance

2018-02-19 Thread SrMordred via Digitalmars-d-learn
On Monday, 19 February 2018 at 05:54:53 UTC, Dmitry Olshansky wrote: The operation is trivial and dataset is rather small. In such cases SIMD with eg array ops is the way to go: result[] = values[] * values2[]; Yes, absolutely right :) I make a simple example to understand why the threads are

Re: multithread/concurrency/parallel methods and performance

2018-02-19 Thread SrMordred via Digitalmars-d-learn
On Monday, 19 February 2018 at 05:49:54 UTC, Nicholas Wilson wrote: As SIZE=1024*1024 (i.e. not much, possibly well within L2 cache for 32bit) it may be that dealing with the concurrency overhead adds a significant amount of overhead. That 'concurrency overhead' is what i´m not getting. Since

How to make AA key a pointer

2018-02-19 Thread Clinton via Digitalmars-d-learn
Hi all, I need advice from better developers on this concern. I'm using an AA to reference another array for quicker access: [code] alias contactId = string; bool[contactId][] matches; ulong[contactId] idsToMatches; bool[string] matchesForId(string id) { return matches.get(idsToMatches[id], b

Re: Building from source on FreeBSD

2018-02-19 Thread Seb via Digitalmars-d-learn
On Monday, 19 February 2018 at 12:01:31 UTC, Jonathan M Davis wrote: On Monday, February 19, 2018 11:43:26 psychoticRabbit via Digitalmars-d- learn wrote: [...] I've never been able to figure this problem out, so I've I always just edited the makefile so that the two programs in CURL_TOOLS a

Re: Could that bug be catch using D's way?

2018-02-19 Thread Basile B. via Digitalmars-d-learn
On Monday, 19 February 2018 at 13:51:50 UTC, Simen Kjærås wrote: On Monday, 19 February 2018 at 13:33:34 UTC, rikki cattermole wrote: https://dlang.org/phobos/std_experimental_checkedint.html#.Checked.min Can't seem to get that to work, so I assumed it's not meant to be used that way: impor

Re: Could that bug be catch using D's way?

2018-02-19 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 19 February 2018 at 13:33:34 UTC, rikki cattermole wrote: https://dlang.org/phobos/std_experimental_checkedint.html#.Checked.min Can't seem to get that to work, so I assumed it's not meant to be used that way: import std.experimental.checkedint; struct MyHook { enum min(T) =

Re: std.traits.isBoolean

2018-02-19 Thread Basile B. via Digitalmars-d-learn
On Monday, 19 February 2018 at 13:07:08 UTC, Tony wrote: It doesn't appear that BooleanTypeof is documented on dlang.org (outside of it's placement on the isBooleanType page). At least it isn't coming up in a "BooleanTypeOf site:dlang.org" search and not on the traits page: https://dlang.org/

Re: Could that bug be catch using D's way?

2018-02-19 Thread rikki cattermole via Digitalmars-d-learn
On 19/02/2018 1:24 PM, Simen Kjærås wrote: On Monday, 19 February 2018 at 12:58:45 UTC, Marc wrote: I'm pretty sure something could be done with Ada's type range but what we could do using D? We can easily define a range type in D. The simple example below probably has awful performance and m

Re: Could that bug be catch using D's way?

2018-02-19 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 19 February 2018 at 12:58:45 UTC, Marc wrote: I'm pretty sure something could be done with Ada's type range but what we could do using D? We can easily define a range type in D. The simple example below probably has awful performance and many holes, but outlines the basic idea. It

Re: std.traits.isBoolean

2018-02-19 Thread Tony via Digitalmars-d-learn
On Sunday, 18 February 2018 at 15:12:50 UTC, Mike Parker wrote: Generally, no. But with alias this, it can be: = import std.traits : BooleanTypeOf; import std.stdio : writeln; struct NoBool { int x; } struct AliasThisBool { bool b; alias b this; } void main() { static if(

Could that bug be catch using D's way?

2018-02-19 Thread Marc via Digitalmars-d-learn
I'm pretty sure something could be done with Ada's type range but what we could do using D?

Re: Building from source on FreeBSD

2018-02-19 Thread psychoticRabbit via Digitalmars-d-learn
On Monday, 19 February 2018 at 12:01:31 UTC, Jonathan M Davis wrote: I've never been able to figure this problem out, so I've I always just edited the makefile so that the two programs in CURL_TOOLS aren't built. IIRC, if you use -v to see the full linker command, it's even actually linking to

Re: Building from source on FreeBSD

2018-02-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, February 19, 2018 11:43:26 psychoticRabbit via Digitalmars-d- learn wrote: > So I finally got around to building from source. > > I have builds working just fine on a variety of linux machines, > it's just a FreeBSD problem I'm having. > > So, on FreeBSD, I can build the dmd directory, a

Building from source on FreeBSD

2018-02-19 Thread psychoticRabbit via Digitalmars-d-learn
So I finally got around to building from source. I have builds working just fine on a variety of linux machines, it's just a FreeBSD problem I'm having. So, on FreeBSD, I can build the dmd directory, and the phobos directory ok. When building tools directory, most tools get built ok, but th

Re: Size threshold replace complex probing with linear search for small hash tables

2018-02-19 Thread Nathan S. via Digitalmars-d-learn
On Monday, 19 February 2018 at 10:22:12 UTC, Nordlöw wrote: I'm currently developing a combined HashMap and HashSet with open addressing You might want to consider using Robin Hood hashing to reduce the worst-case length of collision chains, regardless of what kind of probing scheme you use.

Size threshold replace complex probing with linear search for small hash tables

2018-02-19 Thread Nordlöw via Digitalmars-d-learn
I'm currently developing a combined HashMap and HashSet with open addressing at https://github.com/nordlow/phobos-next/blob/master/src/open_hashmap_or_hashset.d with probing using steps of triangular numbers when length is a power of two at https://github.com/nordlow/phobos-next/blob/master/

Re: std.array.array for immutable data types

2018-02-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, February 19, 2018 07:25:07 Nicholas Wilson via Digitalmars-d- learn wrote: > On Monday, 19 February 2018 at 07:08:49 UTC, Fra Mecca wrote: > > Is there a way to avoid using to! conversion here? > > > > immutable string[] dst = to!(immutable > > string[])(array(pipe.readEnd.byLineCopy));

Re: Trying to forward unwrapped opDispatch names to alias this

2018-02-19 Thread aliak via Digitalmars-d-learn
On Monday, 19 February 2018 at 01:00:23 UTC, Adam D. Ruppe wrote: On Monday, 19 February 2018 at 00:42:05 UTC, aliak wrote: struct B(T) { T t; A a; alias a this; auto opDispatch(string name)() if (hasMember!(T, name)) { return mixin("t." ~ name); Did you perhaps mean `A