On Friday, 24 August 2018 at 20:43:46 UTC, Peter Alexander wrote:
On Friday, 24 August 2018 at 13:04:47 UTC, Uknown wrote:
I was quite surprised by the fact that parallel ran so much
slower than recursive and loop implementations. Does anyone
know why?
n = 100 is too small to see parallelism
I was messing and tried comparing the performance of different
ways to compute the factorial of a number. Here's the benchmark
results:
recursive: 244 ms, 283 μs, and 2 hnsecs
loop: 241 ms, 412 μs, and 3 hnsecs
parallel: 1 sec, 784 ms, 829 μs, and 5 hnsecs
On Wednesday, 27 June 2018 at 15:18:05 UTC, Alex wrote:
On Wednesday, 27 June 2018 at 15:07:57 UTC, Uknown wrote:
On Wednesday, 27 June 2018 at 14:50:25 UTC, Alex wrote:
On Wednesday, 27 June 2018 at 14:29:33 UTC, Uknown wrote:
On Wednesday, 27 June 2018 at 14:21:39 UTC, Alex wrote:
On
On Wednesday, 27 June 2018 at 14:50:25 UTC, Alex wrote:
On Wednesday, 27 June 2018 at 14:29:33 UTC, Uknown wrote:
On Wednesday, 27 June 2018 at 14:21:39 UTC, Alex wrote:
On Wednesday, 27 June 2018 at 13:27:46 UTC, Uknown wrote:
[...]
I see. Ok, one possibility is
source = indexed(source,
On Wednesday, 27 June 2018 at 14:29:18 UTC, Basile B. wrote:
On Wednesday, 27 June 2018 at 14:23:25 UTC, Uknown wrote:
On Wednesday, 27 June 2018 at 14:01:06 UTC, Basile B. wrote:
On Wednesday, 27 June 2018 at 12:25:26 UTC, Uknown wrote:
On Wednesday, 27 June 2018 at 10:22:38 UTC, Vijay Nayar
On Wednesday, 27 June 2018 at 14:21:39 UTC, Alex wrote:
On Wednesday, 27 June 2018 at 13:27:46 UTC, Uknown wrote:
Title says it all. Is there a trivial way to do this?
There are
https://dlang.org/library/std/algorithm/mutation/reverse.html
and
https://dlang.org/library/std/range/retro.html
On Wednesday, 27 June 2018 at 14:01:06 UTC, Basile B. wrote:
On Wednesday, 27 June 2018 at 12:25:26 UTC, Uknown wrote:
On Wednesday, 27 June 2018 at 10:22:38 UTC, Vijay Nayar wrote:
[...]
aliasing a function type only works with the old syntax too:
alias void proto_identifier();
Very
Title says it all. Is there a trivial way to do this?
On Wednesday, 27 June 2018 at 10:22:38 UTC, Vijay Nayar wrote:
Most of the documentation at
https://dlang.org/spec/declaration.html#alias uses examples of
the form: `alias aliasName = other;`, where `aliasName`
becomes the new name to reference `other`. Alternatively, one
may write `alias
On Wednesday, 13 June 2018 at 23:34:02 UTC, Murilo wrote:
Does D use ASCII or UNICODE? It seems to use ASCII since it
causes error whenever I use a non-ASCII character.
Your system might be misconfigured. D can use UTF-8 (Unicode)
too. See https://dlang.org/spec/lex.html#source_text
On Tuesday, 12 June 2018 at 14:21:48 UTC, Adam D. Ruppe wrote:
On Monday, 11 June 2018 at 04:39:54 UTC, Uknown wrote:
Why are the strings getting modified?
I'm guessing it reuses a buffer as it iterates.
"123".byCodeUnit.permutations.writeln;//[123, 213, 312, 132,
231, 321]
[...]
On Monday, 11 June 2018 at 04:12:57 UTC, Adam D. Ruppe wrote:
On Monday, 11 June 2018 at 04:06:44 UTC, Uknown wrote:
The problem is this prints a list of numbers. The task
requires only the largest, so the intuitive fix
I would just pull the max out of it.
I wrote a small program for Project Euler problem 41 (
https://projecteuler.net/problem=41 ).
--- project_euler_41.d
void main()
{
import math_common : primesLessThan;
import std.stdio : writeln;
import std.conv : parse;
import std.algorithm : permutations,
On Thursday, 24 May 2018 at 18:51:31 UTC, Mike Franklin wrote:
I'm trying to find a way to declare a block of code `nothrow:`
when compiling with -betterC, but not `nothrow` when not
compiling with -betterC.
The solution is needed for this PR:
On Friday, 18 May 2018 at 23:53:12 UTC, IntegratedDimensions
wrote:
Why does D complain when using == to compare with null? Is
there really any technical reason? if one just defines == null
to is null then there should be no problem. It seems like a
pedantic move by who ever implemented it and
On Friday, 18 May 2018 at 15:16:52 UTC, Russel Winder wrote:
Hi,
What's the current official position on how to create temporary
files for use during a unittest. I found
https://github.com/dlang/phobos/pull/5788
but it seems to be languishing in the "we have discussed all
the issues that
On Thursday, 10 May 2018 at 11:06:06 UTC, Per Nordlöw wrote:
On Wednesday, 9 May 2018 at 21:09:12 UTC, Meta wrote:
It's a context pointer to the enclosing
function/object/struct. Mark the struct as static to get rid
of it.
Ok, but why an extra void* for `S.tupleof` and not for
`T.tupleof`
On Friday, 4 May 2018 at 07:49:02 UTC, Robert M. Münch wrote:
I have a static C++ and can't make it to get a correct binding
for one function:
DMD: public: unsigned int __cdecl b2d::Context2D::_begin(class
b2d::Image & __ptr64,class b2d::Context2D::InitParams const *
__ptr64 const) __ptr64
On Tuesday, 1 May 2018 at 22:48:08 UTC, Dr.No wrote:
Looking for make application run fast as possible, aside
optimization in the source code, is using 64 bit over 32 really
worth?
With the GC yes, since false pointers become less of an issue.
Also you get to take full advantage of the
On Monday, 30 April 2018 at 01:07:35 UTC, NewUser wrote:
Hi,
How do I pass a d string to a c++ std::string?
NewUser
There is no trivial way to do this as far as I'm aware, mostly
due to C++ mangling issues in DMD. You can try calypso [0] or dpp
[1], which might work. You can also see this
On Saturday, 21 April 2018 at 17:46:05 UTC, Dr.No wrote:
On Saturday, 21 April 2018 at 17:15:47 UTC, Jonathan M Davis
wrote:
On Saturday, April 21, 2018 16:05:22 Dr.No via
Digitalmars-d-learn wrote:
import std.meta : Filter;
enum isNotReservedSymbol(string name) = name != "none" &&
name !=
On Sunday, 22 April 2018 at 01:07:44 UTC, Giles Bathgate wrote:
On Saturday, 21 April 2018 at 19:06:52 UTC, Steven
Schveighoffer wrote:
alloca is an intrinsic, and part of the language technically
-- it has to be.
Why does:
scope c = new C(); // allocate c on stack
scope a = new
On Saturday, 21 April 2018 at 07:37:50 UTC, Mike Franklin wrote:
Does D have some way to dynamically allocate on the stack? I'm
looking for something roughly equivalent to the following C
code.
int doSomething(size_t len)
{
char stackBuffer[len + 1];
doSomethingElse(stackBuffer);
}
On Thursday, 12 April 2018 at 15:38:34 UTC, Chris Katko wrote:
I googled but couldn't find any clear solution.
I've got a 2-D array of strings read from a text file I parsed.
So it's like
0 1 15 0 0
2 12 1 0 0
...
0 1 0 10 0
They come in with spaces, so I join into an array between them.
On Wednesday, 11 April 2018 at 16:25:20 UTC, Jonathan M Davis
wrote:
[...]
Adding a destructor makes the compiler return an error about
lifetimes, with or without -dip1000
https://run.dlang.io/is/ddXqNu
On Monday, 9 April 2018 at 00:25:08 UTC, solidstate1991 wrote:
Would the if(!(myFunctionPointer is null)){} work is I
intended?
Yes, that works as you expect
https://run.dlang.io/is/ZTtm0P
On Saturday, 7 April 2018 at 05:58:10 UTC, Paul Backus wrote:
On Saturday, 7 April 2018 at 05:46:07 UTC, Uknown wrote:
I don't see the error you are talking about:
https://run.dlang.io/is/XWPIc1
Are you using the latest compiler?
Compile with -unittest.
And yes; I'm using DMD 2.079.0.
On Saturday, 7 April 2018 at 05:10:05 UTC, Paul Backus wrote:
I'm playing around with functional programming in D, and have
run into a problem with the following code:
[...]
I don't see the error you are talking about:
https://run.dlang.io/is/XWPIc1
Are you using the latest compiler?
On Friday, 6 April 2018 at 14:43:25 UTC, Ali wrote:
On Friday, 6 April 2018 at 14:31:49 UTC, Alex wrote:
On Friday, 6 April 2018 at 13:41:50 UTC, aerto wrote:
[...]
A question from me, since I am also still learning D
what is the difference between those following two declarations
On Wednesday, 4 April 2018 at 05:28:57 UTC, Carlos Navarro wrote:
As a newbie in D (and making a lots of mistakes), I've found
myself relying heavily in the use of a rudimentary type
inspector to visualize my templated code instantiations.
It's simple and incomplete as hell but good enough to
On Tuesday, 3 April 2018 at 02:31:15 UTC, Uknown wrote:
On Tuesday, 3 April 2018 at 02:24:08 UTC, Domain wrote:
wchar[10] buffer;
toUTF8(buffer);
Error: template `std.utf.toUTF8` cannot deduce function from
argument types `!()(wchar[10])`, candidates are:
On Tuesday, 3 April 2018 at 02:24:08 UTC, Domain wrote:
wchar[10] buffer;
toUTF8(buffer);
Error: template `std.utf.toUTF8` cannot deduce function from
argument types `!()(wchar[10])`, candidates are:
/dlang/dmd/linux/bin64/../../src/phobos/std/utf.d(2713):
`std.utf.toUTF8(S)(S s) if
On Tuesday, 3 April 2018 at 02:10:09 UTC, helxi wrote:
For reference:
https://en.cppreference.com/w/cpp/utility/optional
Nullable!T would be the closest thing:
https://dlang.org/phobos/std_typecons.html#Nullable
I'm not sure how comparable they are though.
On Sunday, 1 April 2018 at 01:19:08 UTC, auto wrote:
What is auto decoding and why it is a problem?
Auto-decoding is essentially related to UTF representation of
Unicode strings. In D, `char[]` and `string` represent UTF8
strings, `wchar[]` and `wstring` represent UTF16 strings and
On Wednesday, 14 March 2018 at 13:36:51 UTC, Andre Pany wrote:
Hi,
I do not understand why struct initializer works for arrays but
not for
associative arrays:
struct Bar
{
string s;
}
struct Foo
{
Bar[string] asso;
Bar[] arr;
}
void main()
{
Foo foo = {
arr: [{s:
On Saturday, 10 March 2018 at 12:00:12 UTC, Richard wrote:
On Saturday, 10 March 2018 at 07:54:33 UTC, Mike Franklin wrote:
On Saturday, 10 March 2018 at 02:25:38 UTC, Richard wrote:
[snip]
Based on the above this seems to work fine so I'll use this
since it's the simplest option.
```
On Tuesday, 6 March 2018 at 14:28:52 UTC, ixid wrote:
/opt/compilers/dmd2/include/std/algorithm/iteration.d(663):
Deprecation: function `std.range.Transposed!(string[],
cast(TransverseOptions)0).Transposed.save` is deprecated - This
function is incorrect and will be removed November 2018. See
On Tuesday, 6 March 2018 at 08:20:05 UTC, J-S Caux wrote:
On Tuesday, 6 March 2018 at 07:12:57 UTC, Robert M. Münch wrote:
On 2018-03-05 20:11:06 +, H. S. Teoh said:
[snip]
Now, with Uknown's trick of using the C math functions, I can
reconsider. It's a bit of a "patch" but at least it
On Monday, 5 March 2018 at 06:01:27 UTC, J-S Caux wrote:
On Monday, 5 March 2018 at 05:40:09 UTC, rikki cattermole wrote:
On 05/03/2018 6:35 PM, J-S Caux wrote:
I'm considering shifting a large existing C++ codebase into D
(it's a scientific code making much use of functions like
atan, log
On Sunday, 25 February 2018 at 06:22:03 UTC, psychoticRabbit
wrote:
On Sunday, 25 February 2018 at 05:40:19 UTC, Jonathan M Davis
wrote:
int[] intArr = iota(1, 11).array();
- Jonathan M Davis
thanks!
oh man. It's so easy to do stuff in D ;-)
But this leads me to a new problem now.
On Tuesday, 20 February 2018 at 14:56:54 UTC, Chris M. wrote:
I'm doing this mainly for experimentation, but the following
piece of code gives all sorts of errors. Hangs, segfaults or
prints nothing and exits
import std.stdio;
import core.stdc.stdlib;
void main()
{
auto f = cast(File *)
On Tuesday, 20 February 2018 at 15:21:59 UTC, Uknown wrote:
On Tuesday, 20 February 2018 at 14:56:54 UTC, Chris M. wrote:
void main()
[snip]
Never mind, I confused FILE* with File...
On Tuesday, 2 January 2018 at 07:17:23 UTC, Uknown wrote:
[snip]
0. Use LDC. It is significantly faster.
1. Utilize the fact that the Mandelbrot set is symmetric about
the X axis.You can half the time taken.
2. Use std.parallelism for using multiple cores on the CPU
3. Use @fastmath of LDC
4.
On Monday, 1 January 2018 at 15:09:53 UTC, Lily wrote:
I started learning D a few days ago, coming from some very
basic C++ knowledge, and I'd like some help getting a program
to run faster. The code is here:
https://github.com/IndigoLily/D-mandelbrot/blob/master/mandelbrot.d
Right now it
On Wednesday, 6 September 2017 at 06:09:46 UTC, Psychological
Cleanup wrote:
What is the return doing there?
The return implies that the function will return the parameter
`s` after it has done whatever it needs to.
It is useful for the compiler to do escape analysis or
So memset would be
45 matches
Mail list logo