WebCam or Video in D

2017-08-13 Thread brian via Digitalmars-d-learn
Howdy folks. Has anyone gotten an example of using D as mechanism to read in video files, specifically from a webcam? I don't see any OpenCV libraries, and the example in the DCV library that uses FFMPEG, I can't get to work (I've raised an issue in Github here

[Issue 17747] extern(C) shared static module constructor should be called in betterC programs

2017-08-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17747 --- Comment #3 from Илья Ярошенко --- (In reply to ZombineDev from comment #2) > AFAIK, C doesn't have static constructors, only C++ has, so your example > should be: > > extern(C++) shared static this() > { > // ... >

Re: wth!! ctfe cannot format floating point at compile time?

2017-08-13 Thread Johnson via Digitalmars-d-learn
On Monday, 14 August 2017 at 03:52:40 UTC, HypperParrow wrote: On Monday, 14 August 2017 at 01:52:16 UTC, Johnson Jones wrote: Error: uncaught CTFE exception std.format.FormatException("Cannot format floating point types at compile-time") called from here: to(0.75) pretty simply, trying to

Re: wth!! ctfe cannot format floating point at compile time?

2017-08-13 Thread Johnson via Digitalmars-d-learn
On Monday, 14 August 2017 at 03:44:27 UTC, Adam D. Ruppe wrote: On Monday, 14 August 2017 at 01:52:16 UTC, Johnson Jones wrote: pretty simply, trying to convert a floating point to a string in a ctfe function and it thinks that it is too complex to do in a ctfe, really? It uses a C function

Re: Does anyone understand how to use "shared" types with concurrency send/receive functions?

2017-08-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, August 13, 2017 16:40:03 crimaniak via Digitalmars-d-learn wrote: > More of this, I think, you can't avoid __gshared for any complex > work. Even mutexes from Phobos doesn't support shared, so I had > to 'cowboy with __gshared' when implementing my site engine. The way to handle shared

Re: wth!! ctfe cannot format floating point at compile time?

2017-08-13 Thread HypperParrow via Digitalmars-d-learn
On Monday, 14 August 2017 at 01:52:16 UTC, Johnson Jones wrote: Error: uncaught CTFE exception std.format.FormatException("Cannot format floating point types at compile-time") called from here: to(0.75) pretty simply, trying to convert a floating point to a string in a ctfe function and it

Re: wth!! ctfe cannot format floating point at compile time?

2017-08-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 14 August 2017 at 01:52:16 UTC, Johnson Jones wrote: pretty simply, trying to convert a floating point to a string in a ctfe function and it thinks that it is too complex to do in a ctfe, really? It uses a C function to do the conversion, which is not available at compile time

Re: Does anyone understand how to use "shared" types with concurrency send/receive functions?

2017-08-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, August 12, 2017 18:57:44 Arek via Digitalmars-d-learn wrote: > I have the folowing problem: > I like to envelope the class object in struct to control the > destruction moment and then send this object to another > thread/fiber (or task, cause I use vibe-d). > > I can't find any

wth!! ctfe cannot format floating point at compile time?

2017-08-13 Thread Johnson Jones via Digitalmars-d-learn
Error: uncaught CTFE exception std.format.FormatException("Cannot format floating point types at compile-time") called from here: to(0.75) pretty simply, trying to convert a floating point to a string in a ctfe function and it thinks that it is too complex to do in a ctfe, really?

Re: Real naive template question

2017-08-13 Thread Nicholas Wilson via Digitalmars-d-learn
On Monday, 14 August 2017 at 00:44:05 UTC, WhatMeForget wrote: module block_template; void main() { template BluePrint(T, U) { T integer; U floatingPoint; } BluePrint!(int, float); } // DMD returns // template.d(13): Error: BluePrint!(int, float) has no effect

Re: I'm the new package maintainer for D on ArchLinux

2017-08-13 Thread WhatMeForget via Digitalmars-d-announce
On Wednesday, 9 August 2017 at 20:50:36 UTC, Stefan Koch wrote: On Wednesday, 9 August 2017 at 20:42:48 UTC, Wild wrote: I hope I can maintain ArchLinux as a great environment to use D. You are not only the new package mainainer but also my new Hero :) +10

Real naive template question

2017-08-13 Thread WhatMeForget via Digitalmars-d-learn
module block_template; void main() { template BluePrint(T, U) { T integer; U floatingPoint; } BluePrint!(int, float); } // DMD returns // template.d(13): Error: BluePrint!(int, float) has no effect // I was expecting something like the following to be created

Re: Who here uses vibe-s3 from code.dlang.org?

2017-08-13 Thread yawniek via Digitalmars-d
On Tuesday, 8 August 2017 at 08:49:33 UTC, Andre Pany wrote: On Monday, 7 August 2017 at 22:46:57 UTC, aberba wrote: vibe-s3 (https://code.dlang.org/packages/vibe-s3) is an Amazon s3 object storage API for D. Has anyone here used or tested it? What was your experiences? It has the tagline

Re: Debugging Visual D using Visual D

2017-08-13 Thread Johnson Jones via Digitalmars-d-debugger
One can prevent building the other projects using the configuration manager. Seems to work fine. One problem is that I cannot seem to get breakpoints to work. Same issues as I mentioned before with visual D saying the symbols haven't been loaded for the document. I do not know if it's the

Debugging Visual D using Visual D

2017-08-13 Thread Johnson Jones via Digitalmars-d-debugger
So, just to let you know, I seemed to be able to setup Visual Studio so that I can debug Visual D(with visual D). To do this: Load the experimental hive: https://blog.agchapman.com/updating-registry-settings-for-visual-studio-2017/ Load the privateregistry.bin file from

Re: mixin()-ed code not treated the same as surrounding code

2017-08-13 Thread Adam D. Ruppe via Digitalmars-d
On Sunday, 13 August 2017 at 19:50:57 UTC, Roman Hargrave wrote: But instead I get: _D8Sequence5Torch12SequenceList6__initZ _D8Sequence5Torch12SequenceList7__ClassZ _D8Sequence5Torch12SequenceList6__vtblZ How are you getting that list? Those particular things are hidden D specific symbols so

Re: mixin()-ed code not treated the same as surrounding code

2017-08-13 Thread Roman Hargrave via Digitalmars-d
Update: Manually defining the class yields the same results (a class with D linkage). What's going on here?

Re: jai-like CTFE string formating

2017-08-13 Thread Stefan Koch via Digitalmars-d
On Sunday, 13 August 2017 at 19:47:37 UTC, Jerry wrote: Seems like it'd be a good idea to pre compute all of phobos for compile time computations, as they should be changing. That would drastically reduce using any of phobos for compile time computation. You cannot do that. The point of

mixin()-ed code not treated the same as surrounding code

2017-08-13 Thread Roman Hargrave via Digitalmars-d
I have a mixin & generator I defined in order to mimic a corresponding CPP macro, DefineList(string name, string typename): // See Torch - List.h, macro DEFINE_NEW_LIST(NAME, TYPE) string DefineList(string name, string typename) { return "class " ~ name ~ " : TorchObject {" ~

Re: jai-like CTFE string formating

2017-08-13 Thread Jerry via Digitalmars-d
Seems like it'd be a good idea to pre compute all of phobos for compile time computations, as they should be changing. That would drastically reduce using any of phobos for compile time computation.

Re: jai-like CTFE string formating

2017-08-13 Thread Sönke Ludwig via Digitalmars-d
Am 13.08.2017 um 20:25 schrieb Stefan Koch: On Sunday, 13 August 2017 at 18:20:15 UTC, Sönke Ludwig wrote: I was a bit shocked by this number and performed a little test with multiple calls to format. Fortunately only the first one takes that long to compile. For 500 different calls I got

[Issue 14488] Deprecate Imaginary and complex types

2017-08-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14488 --- Comment #2 from Iain Buclaw --- Two years gone, now its deprecation time. https://github.com/dlang/dmd/pull/7081 --

Re: Unresolved external symbol InterlockedIncrement

2017-08-13 Thread Igor via Digitalmars-d-learn
On Sunday, 13 August 2017 at 16:29:14 UTC, Igor wrote: I am building a 64 bit windows app with latest DMD and I keep getting this linker error: error LNK2019: unresolved external symbol InterlockedIncrement referenced in function ThreadProc This function should be a part of kernel32.lib

Re: jai-like CTFE string formating

2017-08-13 Thread Stefan Koch via Digitalmars-d
On Sunday, 13 August 2017 at 18:20:15 UTC, Sönke Ludwig wrote: Am 12.08.2017 um 13:47 schrieb Stefan Koch: Hi Guys, I've just implemented a subset of the std.format functionality. In the same style that Johnathan Blow uses for JAI. It's about 10x faster then using std.format and uses much

Re: jai-like CTFE string formating

2017-08-13 Thread Sönke Ludwig via Digitalmars-d
Am 12.08.2017 um 13:47 schrieb Stefan Koch: Hi Guys, I've just implemented a subset of the std.format functionality. In the same style that Johnathan Blow uses for JAI. It's about 10x faster then using std.format and uses much less memory :) the follwing code takes over 250 ms to compile : {

Re: html fetcher/parser

2017-08-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 13 August 2017 at 15:54:45 UTC, Faux Amis wrote: Just curious, but is there a spec of sorts which defines which errors should be fixed and such? The HTML5 spec describes how you are supposed to parse various things, including the recovery paths for broken markup. My module,

[Issue 17088] Access Violation on membership test with shared AA

2017-08-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17088 --- Comment #2 from m.bier...@lostmoment.com --- In DMD 2.075.0 (DMD32 D Compiler v2.075.0) this issue also seems to happen in debug mode, with the following stack trace: object.Error@(0): Access Violation 0x004028CA in

[Issue 17752] New: Switch skips over declaration issued for explicitly uninitialized variables

2017-08-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17752 Issue ID: 17752 Summary: Switch skips over declaration issued for explicitly uninitialized variables Product: D Version: D2 Hardware: All OS: All

[Issue 17751] New: Internal error: ddmd/backend/el.c 2927

2017-08-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17751 Issue ID: 17751 Summary: Internal error: ddmd/backend/el.c 2927 Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: blocker Priority:

Re: Does anyone understand how to use "shared" types with concurrency send/receive functions?

2017-08-13 Thread crimaniak via Digitalmars-d-learn
On Sunday, 13 August 2017 at 11:35:05 UTC, Arek wrote: Yeah, I've read this. But conurrency.send cannot pass immutable object. The same story with Unique. Sorry, read this as 'efficient immutable'. More over, "shared" looks rather like unfinished concept. Yes, exactly. Anyway, _gshared

Unresolved external symbol InterlockedIncrement

2017-08-13 Thread Igor via Digitalmars-d-learn
I am building a 64 bit windows app with latest DMD and I keep getting this linker error: error LNK2019: unresolved external symbol InterlockedIncrement referenced in function ThreadProc This function should be a part of kernel32.lib which I verified is found by using /VERBOSE:LIB linker

Re: html fetcher/parser

2017-08-13 Thread Faux Amis via Digitalmars-d-learn
On 2017-08-13 01:49, Soulsbane wrote: On Saturday, 12 August 2017 at 19:53:22 UTC, Faux Amis wrote: I would like to get into D again by making a small program which fetches a website every X-time and keeps track of all changes within specified dom elements. fetching: should I go for std

Re: newCTFE Status August 2017

2017-08-13 Thread Stefan Koch via Digitalmars-d
On Tuesday, 1 August 2017 at 21:27:32 UTC, Stefan Koch wrote: [ ... ] Hi there, I've just adjusted the memory allocation behavior. newCTFE will now start-out allocating 32M of memory at startup. and increase the allocated space in 8x steps if it hits the limit while executing concat code.

Re: html fetcher/parser

2017-08-13 Thread Faux Amis via Digitalmars-d-learn
On 2017-08-12 22:22, Adam D. Ruppe wrote: On Saturday, 12 August 2017 at 19:53:22 UTC, Faux Amis wrote: [...] [...] --- // compile: $ dmd thisfile.d ~/arsd/{dom,http2,characterencodings} import std.stdio; import arsd.dom; void main() { auto document =

Re: Second release candidate 0.8.1-rc.2

2017-08-13 Thread Johannes Loher via Digitalmars-d-announce
On Saturday, 12 August 2017 at 12:43:14 UTC, Sönke Ludwig wrote: v0.8.1-rc.2 now supports setting a version "VibeUseOpenSSL11" in the package recipe to compile against the OpenSSL 1.1.0 API on systems that don't have 1.0.1 anymore. This is great, Thank you!

[Issue 17193] selective imports -> deprecation warnings even if symbol is not used

2017-08-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17193 johanenge...@weka.io changed: What|Removed |Added Keywords||industry CC|

Re: C++ linkage specifics WRT virtual vs non-virtual member functions

2017-08-13 Thread Timon Gehr via Digitalmars-d
On 13.08.2017 09:18, Roman Hargrave wrote: I'm writing some bindings and have run in to a dilemma due to the lack of explicit information on how the D compiler "decides" to use virtual dispatch for a member function or not. Specifically, I have a C++ library that _explicitly_ marks some

Re: DIP 1011-extern(delegate)--Formal Review

2017-08-13 Thread Manu via Digitalmars-d
On 12 August 2017 at 20:44, Patrick Schluter via Digitalmars-d < digitalmars-d@puremagic.com> wrote: > On Friday, 11 August 2017 at 17:57:30 UTC, Dominikus Dittes Scherkl wrote: > >> On Friday, 11 August 2017 at 10:45:03 UTC, Mike Parker wrote: >> >>> The first stage of the formal review for DIP

[Issue 17747] extern(C) shared static module constructor should be called in betterC programs

2017-08-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17747 ZombineDev changed: What|Removed |Added Keywords||betterC, C++

[Issue 17748] extern(C) do nothing on struct methods

2017-08-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17748 ZombineDev changed: What|Removed |Added Keywords||diagnostic

Re: jai-like CTFE string formating

2017-08-13 Thread Manu via Digitalmars-d
On 13 August 2017 at 12:07, Stefan Koch via Digitalmars-d < digitalmars-d@puremagic.com> wrote: > On Sunday, 13 August 2017 at 00:42:08 UTC, Manu wrote: > >> On 13 August 2017 at 00:15, Stefan Koch via Digitalmars-d < >> >>> [ ... ] >>> >> >> If you're keen to introduce a new function, I'd

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread via Digitalmars-d-learn
On Sunday, 13 August 2017 at 09:56:44 UTC, Johan Engelen wrote: On Sunday, 13 August 2017 at 09:15:48 UTC, amfvcg wrote: Change the parameter for this array size to be taken from stdin and I assume that these optimizations will go away. This is paramount for all of the testing, examining,

Re: Read/Write memory barriers in D?

2017-08-13 Thread Igor via Digitalmars-d-learn
On Sunday, 13 August 2017 at 11:58:56 UTC, Daniel Kozak wrote: or maybe use core.atomic.atomicLoad and store with right https://dlang.org/phobos/core_atomic.html#.MemoryOrder On Sun, Aug 13, 2017 at 1:51 PM, Daniel Kozak wrote: maybe something like

Re: newCTFE Status August 2017

2017-08-13 Thread Stefan Koch via Digitalmars-d
On Tuesday, 1 August 2017 at 21:27:32 UTC, Stefan Koch wrote: [ ... ] Hi Guys, I've fixed a few ABI bugs and as a result my alternative to std.bitmanip.bitfields complies now. I've also made an intrinsic for the concat operation. Which causes ~= to be 6-10x faster when it's heavily used.

Re: Read/Write memory barriers in D?

2017-08-13 Thread Daniel Kozak via Digitalmars-d-learn
or maybe use core.atomic.atomicLoad and store with right https://dlang.org/phobos/core_atomic.html#.MemoryOrder On Sun, Aug 13, 2017 at 1:51 PM, Daniel Kozak wrote: > maybe something like https://dlang.org/phobos/ > core_bitop.html#.volatileLoad and https://dlang.org/phobos/

Re: Read/Write memory barriers in D?

2017-08-13 Thread Daniel Kozak via Digitalmars-d-learn
maybe something like https://dlang.org/phobos/core_bitop.html#.volatileLoad and https://dlang.org/phobos/core_bitop.html#.volatileStore On Sun, Aug 13, 2017 at 1:37 PM, Igor via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > I am converting a C code that uses this macro: > >

Read/Write memory barriers in D?

2017-08-13 Thread Igor via Digitalmars-d-learn
I am converting a C code that uses this macro: #define CompletePastWritesBeforeFutureWrites _WriteBarrier(); _mm_sfence() As far as I see core.atomic:atomicFence() is the equivalent of _mm_sfence() but I can't find what would be the equivalent of _WriteBarrier(). As far as I understand it

Re: Does anyone understand how to use "shared" types with concurrency send/receive functions?

2017-08-13 Thread Arek via Digitalmars-d-learn
On Sunday, 13 August 2017 at 02:50:13 UTC, crimaniak wrote: On Saturday, 12 August 2017 at 18:57:44 UTC, Arek wrote: I have the folowing problem: I like to envelope the class object in struct to control the destruction moment and then send this object to another thread/fiber (or task, cause I

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread via Digitalmars-d-learn
On Sunday, 13 August 2017 at 09:41:39 UTC, Johan Engelen wrote: On Sunday, 13 August 2017 at 09:08:14 UTC, Petar Kirov [ZombineDev] wrote: [...] [...] Execution of sum_subranges is already O(1), because the calculation of the sum is delayed: the return type of the function is not

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread Johan Engelen via Digitalmars-d-learn
On Sunday, 13 August 2017 at 09:15:48 UTC, amfvcg wrote: Change the parameter for this array size to be taken from stdin and I assume that these optimizations will go away. This is paramount for all of the testing, examining, and comparisons that are discussed in this thread. Full

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread Johan Engelen via Digitalmars-d-learn
On Sunday, 13 August 2017 at 09:08:14 UTC, Petar Kirov [ZombineDev] wrote: This instantiation: sum_subranges(std.range.iota!(int, int).iota(int, int).Result, uint) of the following function: auto sum_subranges(T)(T input, uint range) { import std.range : chunks, ElementType, array;

Re: Launch and obtain thread output during compile time

2017-08-13 Thread data pulverizer via Digitalmars-d-learn
On Sunday, 13 August 2017 at 08:09:28 UTC, Petar Kirov [ZombineDev] wrote: On Sunday, 13 August 2017 at 07:37:15 UTC, data pulverizer wrote: Hi all, Is it possible to launch/spawn a thread/fibre or some other appropriate item and obtain an immutable/enum or some appropriate output at

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread amfvcg via Digitalmars-d-learn
On Sunday, 13 August 2017 at 09:08:14 UTC, Petar Kirov [ZombineDev] wrote: There's one especially interesting result: This instantiation: sum_subranges(std.range.iota!(int, int).iota(int, int).Result, uint) of the following function: auto sum_subranges(T)(T input, uint range) { import

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread via Digitalmars-d-learn
On Sunday, 13 August 2017 at 08:43:29 UTC, amfvcg wrote: On Sunday, 13 August 2017 at 08:33:53 UTC, Petar Kirov [ZombineDev] wrote: With Daniel's latest version ( http://forum.dlang.org/post/mailman.5963.1502612885.31550.digitalmars-d-le...@puremagic.com ) $ ldc2 -O3 --release

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread amfvcg via Digitalmars-d-learn
On Sunday, 13 August 2017 at 08:33:53 UTC, Petar Kirov [ZombineDev] wrote: With Daniel's latest version ( http://forum.dlang.org/post/mailman.5963.1502612885.31550.digitalmars-d-le...@puremagic.com ) $ ldc2 -O3 --release sum_subranges2.d $ ./sum_subranges2 210 ms, 838 μs, and 8 hnsecs

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread ikod via Digitalmars-d-learn
On Sunday, 13 August 2017 at 08:32:50 UTC, amfvcg wrote: Gives me 5 μs and 2 hnsecs 5000 3 secs, 228 ms, 837 μs, and 4 hnsecs 5000 And you've compiled it with? Btw. clang for c++ version works worse than gcc (for this case [112ms vs 180ms]). DMD64 D Compiler v2.074.1

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread Daniel Kozak via Digitalmars-d-learn
And this one is awesome :P http://ideone.com/muehUw On Sun, Aug 13, 2017 at 10:27 AM, Daniel Kozak wrote: > this one is even faster than c++: > http://ideone.com/TRDsOo > > On Sun, Aug 13, 2017 at 10:00 AM, Daniel Kozak wrote: > >> my second version on ldc

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread via Digitalmars-d-learn
On Sunday, 13 August 2017 at 08:29:30 UTC, Petar Kirov [ZombineDev] wrote: On Sunday, 13 August 2017 at 08:13:56 UTC, amfvcg wrote: On Sunday, 13 August 2017 at 08:00:53 UTC, Daniel Kozak wrote: my second version on ldc takes 380ms and c++ version on same compiler (clang), takes 350ms, so it

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread amfvcg via Digitalmars-d-learn
Gives me 5 μs and 2 hnsecs 5000 3 secs, 228 ms, 837 μs, and 4 hnsecs 5000 And you've compiled it with? Btw. clang for c++ version works worse than gcc (for this case [112ms vs 180ms]).

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread via Digitalmars-d-learn
On Sunday, 13 August 2017 at 08:13:56 UTC, amfvcg wrote: On Sunday, 13 August 2017 at 08:00:53 UTC, Daniel Kozak wrote: my second version on ldc takes 380ms and c++ version on same compiler (clang), takes 350ms, so it seems to be almost same Ok, on ideone (ldc 1.1.0) it timeouts, on dpaste

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread ikod via Digitalmars-d-learn
On Sunday, 13 August 2017 at 08:13:56 UTC, amfvcg wrote: On Sunday, 13 August 2017 at 08:00:53 UTC, Daniel Kozak wrote: my second version on ldc takes 380ms and c++ version on same compiler (clang), takes 350ms, so it seems to be almost same Ok, on ideone (ldc 1.1.0) it timeouts, on dpaste

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread Daniel Kozak via Digitalmars-d-learn
this one is even faster than c++: http://ideone.com/TRDsOo On Sun, Aug 13, 2017 at 10:00 AM, Daniel Kozak wrote: > my second version on ldc takes 380ms and c++ version on same compiler > (clang), takes 350ms, so it seems to be almost same > > On Sun, Aug 13, 2017 at 9:51 AM,

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread amfvcg via Digitalmars-d-learn
On Sunday, 13 August 2017 at 08:00:53 UTC, Daniel Kozak wrote: my second version on ldc takes 380ms and c++ version on same compiler (clang), takes 350ms, so it seems to be almost same Ok, on ideone (ldc 1.1.0) it timeouts, on dpaste (ldc 0.12.0) it gets killed. What version are you using?

Re: Launch and obtain thread output during compile time

2017-08-13 Thread via Digitalmars-d-learn
On Sunday, 13 August 2017 at 07:37:15 UTC, data pulverizer wrote: Hi all, Is it possible to launch/spawn a thread/fibre or some other appropriate item and obtain an immutable/enum or some appropriate output at compile-time? For instance return an immutable(string) from the external thread to

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread Daniel Kozak via Digitalmars-d-learn
my second version on ldc takes 380ms and c++ version on same compiler (clang), takes 350ms, so it seems to be almost same On Sun, Aug 13, 2017 at 9:51 AM, amfvcg via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Sunday, 13 August 2017 at 07:30:32 UTC, Daniel Kozak wrote: >

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread amfvcg via Digitalmars-d-learn
On Sunday, 13 August 2017 at 07:30:32 UTC, Daniel Kozak wrote: Here is more D idiomatic way: import std.stdio : writeln; import std.algorithm.comparison: min; import std.algorithm.iteration: sum; import core.time: MonoTime, Duration; auto sum_subranges(T)(T input, uint range) { import

Re: C++ linkage specifics WRT virtual vs non-virtual member functions

2017-08-13 Thread via Digitalmars-d
On Sunday, 13 August 2017 at 07:18:31 UTC, Roman Hargrave wrote: I'm writing some bindings and have run in to a dilemma due to the lack of explicit information on how the D compiler "decides" to use virtual dispatch for a member function or not. Specifically, I have a C++ library that

Launch and obtain thread output during compile time

2017-08-13 Thread data pulverizer via Digitalmars-d-learn
Hi all, Is it possible to launch/spawn a thread/fibre or some other appropriate item and obtain an immutable/enum or some appropriate output at compile-time? For instance return an immutable(string) from the external thread to be used as the input to a template parameter or a CTFE function.

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread Daniel Kozak via Digitalmars-d-learn
Here is more D idiomatic way: import std.stdio : writeln; import std.algorithm.comparison: min; import std.algorithm.iteration: sum; import core.time: MonoTime, Duration; auto sum_subranges(T)(T input, uint range) { import std.array : array; import std.range : chunks, ElementType;

C++ linkage specifics WRT virtual vs non-virtual member functions

2017-08-13 Thread Roman Hargrave via Digitalmars-d
I'm writing some bindings and have run in to a dilemma due to the lack of explicit information on how the D compiler "decides" to use virtual dispatch for a member function or not. Specifically, I have a C++ library that _explicitly_ marks some member functions as virtual, in addition to a

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread Daniel Kozak via Digitalmars-d-learn
this works ok for me with ldc compiler, gdc does not work on my arch machine so I can not do comparsion to your c++ versin (clang does not work with your c++ code) import std.stdio : writeln; import std.algorithm.comparison: min; import std.algorithm.iteration: sum; import core.time: MonoTime,

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread Neia Neutuladh via Digitalmars-d-learn
On Sunday, 13 August 2017 at 06:09:39 UTC, amfvcg wrote: Hi all, I'm solving below task: Well, for one thing, you are preallocating in C++ code but not in D. On my machine, your version of the code completes in 3.175 seconds. Changing it a little reduces it to 0.420s: T[] result =

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread Roman Hargrave via Digitalmars-d-learn
On Sunday, 13 August 2017 at 06:09:39 UTC, amfvcg wrote: Hi all, I'm solving below task: given container T and value R return sum of R-ranges over T. An example: input : T=[1,1,1] R=2 output : [2, 1] input : T=[1,2,3] R=1 output : [1,2,3] (see dlang unittests for more examples) Below c++

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread rikki cattermole via Digitalmars-d-learn
On 13/08/2017 7:09 AM, amfvcg wrote: Hi all, I'm solving below task: given container T and value R return sum of R-ranges over T. An example: input : T=[1,1,1] R=2 output : [2, 1] input : T=[1,2,3] R=1 output : [1,2,3] (see dlang unittests for more examples) Below c++ code compiled with

D outperformed by C++, what am I doing wrong?

2017-08-13 Thread amfvcg via Digitalmars-d-learn
Hi all, I'm solving below task: given container T and value R return sum of R-ranges over T. An example: input : T=[1,1,1] R=2 output : [2, 1] input : T=[1,2,3] R=1 output : [1,2,3] (see dlang unittests for more examples) Below c++ code compiled with g++-5.4.0 -O2 -std=c++14 runs on my