On Wednesday, 6 May 2020 at 06:54:07 UTC, drug wrote:
Thing are really interesting. So there is a space to improve
performance in 2.5 times :-)
Yes, `array` is smart enough and if you call it on another
array it is no op.
What means `--fast` in Chapel? Do you try `--fast-math` in ldc?
Don't kno
On Wednesday, 6 May 2020 at 06:49:13 UTC, drug wrote:
... Then you can pass the arguments in ctor of the derived
class like:
```
foreach(long i; 0..n)
new DerivedThread(double)(i), cast(double)(i + 1), i,
z).start(); thread_joinAll();
```
not tested example of derived thread
```
class Der
On 2020-05-06 05:25, data pulverizer wrote:
I have been using std.parallelism and that has worked quite nicely but
it is not fully utilising all the cpu resources in my computation
If you happen to be using macOS, I know that when std.parallelism checks
how many cores the computer has, it chec
On Wednesday, 6 May 2020 at 07:27:19 UTC, data pulverizer wrote:
On Wednesday, 6 May 2020 at 06:54:07 UTC, drug wrote:
Thing are really interesting. So there is a space to improve
performance in 2.5 times :-)
Yes, `array` is smart enough and if you call it on another
array it is no op.
What mea
On Wednesday, 6 May 2020 at 07:27:19 UTC, data pulverizer wrote:
On Wednesday, 6 May 2020 at 06:54:07 UTC, drug wrote:
Thing are really interesting. So there is a space to improve
performance in 2.5 times :-)
Yes, `array` is smart enough and if you call it on another
array it is no op.
What mea
On 2020-05-06 08:54, drug wrote:
Do you try `--fast-math` in ldc? Don't know if 05 use this flag
Try the following flags as well:
`-mcpu=native -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto`
--
/Jacob Carlborg
06.05.2020 10:42, data pulverizer пишет:
On Wednesday, 6 May 2020 at 07:27:19 UTC, data pulverizer wrote:
On Wednesday, 6 May 2020 at 06:54:07 UTC, drug wrote:
Thing are really interesting. So there is a space to improve
performance in 2.5 times :-)
Yes, `array` is smart enough and if you call
On 2020-05-06 06:04, Mathias LANG wrote:
In general, if you want to parallelize something, you should aim to have
as many threads as you have cores.
That should be _logical_ cores. If the CPU supports hyper threading it
can run two threads per core.
--
/Jacob Carlborg
On Wednesday, 6 May 2020 at 07:42:44 UTC, data pulverizer wrote:
On Wednesday, 6 May 2020 at 07:27:19 UTC, data pulverizer wrote:
On Wednesday, 6 May 2020 at 06:54:07 UTC, drug wrote:
Thing are really interesting. So there is a space to improve
performance in 2.5 times :-)
Yes, `array` is smart
On 2020-05-05 19:11, learner wrote:
On Tuesday, 5 May 2020 at 16:41:06 UTC, Adam D. Ruppe wrote:
typeof(return)
Thank you, that was indeed easy!
Is it possible to retrieve also the caller return type? Something like:
Yes, kind of:
void foo(string caller = __FUNCTION__)()
{
import std.
On Wednesday, 6 May 2020 at 07:47:59 UTC, drug wrote:
06.05.2020 10:42, data pulverizer пишет:
On Wednesday, 6 May 2020 at 07:27:19 UTC, data pulverizer
wrote:
On Wednesday, 6 May 2020 at 06:54:07 UTC, drug wrote:
Thing are really interesting. So there is a space to improve
performance in 2.5
On Wednesday, 6 May 2020 at 07:57:46 UTC, WebFreak001 wrote:
On Wednesday, 6 May 2020 at 07:42:44 UTC, data pulverizer wrote:
On Wednesday, 6 May 2020 at 07:27:19 UTC, data pulverizer
wrote:
Just tried removing the boundscheck and got 1.5 seconds in D!
Cool! But before getting too excited I w
06.05.2020 11:18, data pulverizer пишет:
CPU usage now revs up almost has time to touch 100% before the process
is finished! Interestingly using `--boundscheck=off` without
`--ffast-math` gives a timing of around 4 seconds and, whereas using
`--ffast-math` without `--boundscheck=off` made no
Hello,
I'm choking on a piece of C++ I have no idea about how to
translate to D.
template typename std::enable_if< std::is_const::value == true,
void>::type* = nullptr>
constexpr const char *modifier() const {
return "[in] ";
}
template typename std::enab
On Wednesday, 6 May 2020 at 09:19:10 UTC, drug wrote:
06.05.2020 12:07, wjoe пишет:
Hello,
I'm choking on a piece of C++ I have no idea about how to
translate to D.
template typename std::enable_if< std::is_const::value ==
true, void>::type* = nullptr>
constexpr const char
On Wednesday, 6 May 2020 at 08:28:41 UTC, drug wrote:
What is current D time? ...
Current Times:
D: ~ 1.5 seconds
Chapel: ~ 9 seconds
Julia: ~ 35 seconds
That would be really nice if you make the resume of your
research.
Yes, I'll do a blog or something on GitHub and link it.
Thanks
On Tuesday, 5 May 2020 at 20:29:13 UTC, Steven Schveighoffer
wrote:
the optimizer recognizes what you are doing and changes your
code to:
writeln(1_000_000_001);
Oh yes a classic constant folding. The other thing to worry about
is dead code elimination. Walter has a nice story where he sent
On Tuesday, 5 May 2020 at 19:24:41 UTC, WebFreak001 wrote:
On Tuesday, 5 May 2020 at 18:41:50 UTC, learner wrote:
Good morning,
Trying to do this:
```
bool foo(string s) nothrow { return s.all!isDigit; }
```
I realised that the conversion from char to dchar could throw.
I need to validate an
06.05.2020 12:07, wjoe пишет:
Hello,
I'm choking on a piece of C++ I have no idea about how to translate to D.
template typename std::enable_if< std::is_const::value == true,
void>::type* = nullptr>
constexpr const char *modifier() const {
return "[in] ";
}
On Wednesday, 6 May 2020 at 10:57:59 UTC, learner wrote:
On Tuesday, 5 May 2020 at 19:24:41 UTC, WebFreak001 wrote:
On Tuesday, 5 May 2020 at 18:41:50 UTC, learner wrote:
Good morning,
Trying to do this:
```
bool foo(string s) nothrow { return s.all!isDigit; }
```
I realised that the convers
On Wednesday, 6 May 2020 at 08:04:16 UTC, Jacob Carlborg wrote:
On 2020-05-05 19:11, learner wrote:
On Tuesday, 5 May 2020 at 16:41:06 UTC, Adam D. Ruppe wrote:
typeof(return)
Thank you, that was indeed easy!
Is it possible to retrieve also the caller return type?
Something like:
Yes, ki
On 5/6/20 2:49 AM, drug wrote:
06.05.2020 09:24, data pulverizer пишет:
On Wednesday, 6 May 2020 at 05:44:47 UTC, drug wrote:
proc is already a delegate, so &proc is a pointer to the delegate,
just pass a `proc` itself
Thanks done that but getting a range violation on z which was not
there
On Wednesday, 6 May 2020 at 09:40:47 UTC, wjoe wrote:
yes, I did read the spec. I read the language spec on traits as
well as std.traits docs as well as searching the internet for a
solution since day before yesterday. But I couldn't bring it
together because
} else static if (__traits(isRe
On Wed, May 06, 2020 at 09:59:48AM +, welkam via Digitalmars-d-learn wrote:
> On Tuesday, 5 May 2020 at 20:29:13 UTC, Steven Schveighoffer wrote:
> > the optimizer recognizes what you are doing and changes your code
> > to:
> >
> > writeln(1_000_000_001);
> >
> Oh yes a classic constant foldi
On 2020-05-06 12:23, data pulverizer wrote:
Yes, I'll do a blog or something on GitHub and link it.
It would be nice if you could get it published on the Dlang blog [1].
One usually get paid for that. Contact Mike Parker.
[1] https://blog.dlang.org
--
/Jacob Carlborg
On Wednesday, 6 May 2020 at 09:07:22 UTC, wjoe wrote:
Hello,
I'm choking on a piece of C++ I have no idea about how to
translate to D.
std::is_reference
In general, you can't. In D, `ref` is not part of the type, it's
a "storage class", and as such it is a property that a function
paramet
06.05.2020 16:57, Steven Schveighoffer пишет:
```
foreach(i; 0..n) // instead of for(long i = 0; i < n;)
```
I guess that `proc` delegate cant capture `i` var of `foreach` loop so
the range violation doesn't happen.
foreach over a range of integers is lowered to an equivalent for loop,
so tha
06.05.2020 13:23, data pulverizer пишет:
On Wednesday, 6 May 2020 at 08:28:41 UTC, drug wrote:
What is current D time? ...
Current Times:
D: ~ 1.5 seconds
Chapel: ~ 9 seconds
Julia: ~ 35 seconds
Oh, I'm impressed. I thought that D time has been decreased by 1.5
seconds but it is 1.5
On 5/6/20 2:29 PM, drug wrote:
06.05.2020 16:57, Steven Schveighoffer пишет:
```
foreach(i; 0..n) // instead of for(long i = 0; i < n;)
```
I guess that `proc` delegate cant capture `i` var of `foreach` loop
so the range violation doesn't happen.
foreach over a range of integers is lowered to
On Tuesday, 5 May 2020 at 20:07:54 UTC, RegeleIONESCU wrote:
[...]
Python should be ruled out, this is not its war :)
I have done benchmarks against NumPy if you are interested:
https://github.com/tastyminerals/mir_benchmarks
How do you exactly do that?
Like if I have two dates as std.datetime.DateTime
How will I get the months or years between the two dates?
I was surprised to learn that Duration does not support them and
only has weeks, days etc. but not months or years.
I can't seem to find any standard way of
On Wednesday, 6 May 2020 at 19:51:01 UTC, bauss wrote:
How will I get the months or years between the two dates?
What's the length of a month or a year? That's the tricky part -
they have variable lengths. So a difference of one month is not
super precise.
You could probably just do days /
On Wednesday, 6 May 2020 at 19:58:59 UTC, Adam D. Ruppe wrote:
On Wednesday, 6 May 2020 at 19:51:01 UTC, bauss wrote:
How will I get the months or years between the two dates?
What's the length of a month or a year? That's the tricky part
- they have variable lengths. So a difference of one m
On Wednesday, 6 May 2020 at 17:31:39 UTC, Jacob Carlborg wrote:
On 2020-05-06 12:23, data pulverizer wrote:
Yes, I'll do a blog or something on GitHub and link it.
It would be nice if you could get it published on the Dlang
blog [1]. One usually get paid for that. Contact Mike Parker.
[1]
I'm writing a simple command line tool to send data by UDP once
per second forever, to test some software on another machine.
Not actually forever, of course, but until ^C or I hit 'Q'. I
want to tap keys to make other things happen, like change the
data or rate of sending.
Not sure of the b
On Wednesday, 6 May 2020 at 23:10:05 UTC, data pulverizer wrote:
The -O3 -O5 optimization on the ldc compiler is instrumental in
bringing the times down, going with -02 based optimization even
with the other flags gives us ~ 13 seconds for the 10,000
dataset rather than the very nice 1.5 second
On 07.05.20 02:13, Daren Scot Wilson wrote:
import std.stdio;
import core.stdc.stdio; // for getchar(). There's nothing similar in D
std libs?
import std.concurrency;
import core.thread; // just for sleep()
Instead of the comment you can write:
import core.thread: sleep;
bool running
On Thursday, 7 May 2020 at 01:02:57 UTC, ag0aep6g wrote:
Thank you, this is 110% helpful.
Actually, I'd like to return the excess 10%. My dmd compiler
does not like:
import core.thread: sleep;
so I put the code back the way I had, just to get on with work.
Use `shared` so that all thr
On Thursday, 7 May 2020 at 01:33:12 UTC, Daren Scot Wilson wrote:
import core.thread: sleep;
It sould be
import core.thread : Thread;
Thread.sleep(1.secs); // or whatever
sleep is a static method on the Thread class.
On Wednesday, 6 May 2020 at 10:23:17 UTC, data pulverizer wrote:
D: ~ 1.5 seconds
This is going to sound absurd but can we do even better? If none
of the optimizations we have so far is using simd maybe we can
get even better performance by using it. I think I need to go and
read a simd
40 matches
Mail list logo