On Sunday, 17 May 2020 at 09:41:55 UTC, Johan wrote:
On Sunday, 17 May 2020 at 03:30:57 UTC, Adnan wrote:
Hello, I am trying to examine what causes my similar D
solution to lag behind performance.
In the link, they don't have ldc or gdc but according to my
machine, the dmd generated code
On Sunday, 17 May 2020 at 11:39:30 UTC, kinke wrote:
As a side note, using jagged arrays for multiple dimensions
should probably be avoided whenever you can.
By jagged array, do you mean vector of vectors? What would be an
alternative?
On Sunday, 17 May 2020 at 11:39:30 UTC, kinke wrote:
DMD v2.091:
* dmd -m64 -O -release -boundscheck=off -run ..\speed.d aa bbc:
~11 μs
I forgot `-inline` for DMD; that reduces the speed, yielding ~16
μs.
On Sunday, 17 May 2020 at 03:30:57 UTC, Adnan wrote:
In my machine, if you feed "aa" and "bbc" to the function, ldc
generated code takes around 400 microseconds. I don't have an
access to gdc in my machine.
https://imgshare.io/image/NN8Xmp
Full code:
D : https://run.dlang.io/is/vLj7BC
On Sunday, 17 May 2020 at 03:30:57 UTC, Adnan wrote:
Hello, I am trying to examine what causes my similar D solution
to lag behind performance.
In the link, they don't have ldc or gdc but according to my
machine, the dmd generated code isn't really far behind ldc
generated code.
Hello, I am trying to examine what causes my similar D solution
to lag behind performance.
In the link, they don't have ldc or gdc but according to my
machine, the dmd generated code isn't really far behind ldc
generated code.
So here is the actual code:
ulong levenshteinEditDistance(T)(in
On Fri, Mar 13, 2020 at 09:30:16AM -0400, Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On 3/13/20 5:24 AM, H. S. Teoh wrote:
> > Note that `arg ~ arg` may allocate, but it also may not if the
> > current buffer for `arg` is big enough to accomodate both.
>
> That always allocates. Only
On 3/13/20 5:24 AM, H. S. Teoh wrote:
Note that `arg ~ arg` may allocate, but it also may not if the current
buffer for `arg` is big enough to accomodate both.
That always allocates. Only appending may avoid allocation:
arg ~= arg;
But, I would instead use ranges if possible to avoid all
On Friday, 13 March 2020 at 03:40:11 UTC, Adnan wrote:
Where am I losing performance?
It is nonsensical to say without measuring. Humans are
notoriously bad at predicting performance issues. Wrap all your
hardworking code into a loop with like 100 iterations, compile
and run:
$ perf
On Fri, Mar 13, 2020 at 03:40:11AM +, Adnan via Digitalmars-d-learn wrote:
> In my machine the following D code compiled with release flag and LDC
> performs over 230ms while the similar Go code performs under 120ms.
>
> string smallestRepr(const string arg) {
> import std.format :
In my machine the following D code compiled with release flag and
LDC performs over 230ms while the similar Go code performs under
120ms.
string smallestRepr(const string arg) {
import std.format : format;
const repeated = format!"%s%s"(arg, arg);
string result;
On Monday, 5 September 2016 at 12:32:49 UTC, Lodovico Giaretta
wrote:
On Monday, 5 September 2016 at 12:15:35 UTC, dom wrote:
[...]
You misunderstood the error message and the lambda syntax (it
also happened to me the first time).
The grammar says that you can use one of these syntaxes:
On Monday, 5 September 2016 at 12:30:37 UTC, Daniel Kozak wrote:
Dne 5.9.2016 v 14:15 dom via Digitalmars-d-learn napsal(a):
...
but what is the difference between a lambda (=>) and a
functions/delegates?
i think this is a major pitfall for newcomers, and should be
adressed somehow.
On Monday, 5 September 2016 at 12:15:35 UTC, dom wrote:
[...]
You misunderstood the error message and the lambda syntax (it
also happened to me the first time).
The grammar says that you can use one of these syntaxes:
1) `(arguments) {block of code}`
2) `(arguments) => expression`, which
Dne 5.9.2016 v 14:30 Daniel Kozak napsal(a):
Dne 5.9.2016 v 14:15 dom via Digitalmars-d-learn napsal(a):
...
but what is the difference between a lambda (=>) and a
functions/delegates?
i think this is a major pitfall for newcomers, and should be adressed
somehow.
Yes, R
Dne 5.9.2016 v 14:15 dom via Digitalmars-d-learn napsal(a):
...
but what is the difference between a lambda (=>) and a
functions/delegates?
i think this is a major pitfall for newcomers, and should be adressed
somehow.
Yes, RTFM :)
new AsyncHttpGet("www.dprogramming.com", 80, "/index.php",
(string content)
{
dummy = 1; // this is of type delegate
});
but what is the difference between a lambda (=>) and a
functions/delegates?
i think this is a major pitfall for newcomers, and should be adressed
somehow.
index.php", (string content)
{
dummy = 1; // this is of type delegate
});
but what is the difference between a lambda (=>) and a
functions/delegates?
i think this is a major pitfall for newcomers, and should be
adressed somehow.
On Saturday, 7 July 2012 at 03:02:07 UTC, akaz wrote:
On Friday, 6 July 2012 at 21:10:56 UTC, Simon wrote:
On 06/07/2012 16:39, Alex Rønne Petersen wrote:
Never mind what D says, even in C/C++ just doing the p += 10
is invalid.
Creating a pointer that points at invalid memory is just as
Hi,
Reading about the C++11, I stumbled upon this:
http://www2.research.att.com/~bs/C++0xFAQ.html#gc-abi
Specifically (quote):
int* p = new int;
p+=10;
// ... collector may run here ...
p-=10;
*p = 10;// can we be sure that the int is still
06.07.2012 17:43, akaz пишет:
Hi,
Reading about the C++11, I stumbled upon this:
http://www2.research.att.com/~bs/C++0xFAQ.html#gc-abi
Specifically (quote):
int* p = new int;
p+=10;
// ... collector may run here ...
p-=10;
*p = 10;// can we be sure that
If you are interested in D read this first:
http://dlang.org/garbage.html
You can find there e.g.:
Do not add or subtract an offset to a pointer such that the
result points outside of the bounds of the garbage collected
object originally allocated.
So `p+=10;` is already undefined behavior.
On 06-07-2012 16:07, Denis Shelomovskij wrote:
06.07.2012 17:43, akaz пишет:
Hi,
Reading about the C++11, I stumbled upon this:
http://www2.research.att.com/~bs/C++0xFAQ.html#gc-abi
Specifically (quote):
int* p = new int;
p+=10;
// ... collector may run here ...
p-=10;
*p = 10; // can we be
On 07/06/2012 05:39 PM, Alex Rønne Petersen wrote:
On 06-07-2012 16:07, Denis Shelomovskij wrote:
06.07.2012 17:43, akaz пишет:
Hi,
Reading about the C++11, I stumbled upon this:
http://www2.research.att.com/~bs/C++0xFAQ.html#gc-abi
Specifically (quote):
int* p = new int;
p+=10;
// ...
On Friday, 6 July 2012 at 15:39:40 UTC, Alex Rønne Petersen
wrote:
On 06-07-2012 16:07, Denis Shelomovskij wrote:
06.07.2012 17:43, akaz пишет:
Hi,
Reading about the C++11, I stumbled upon this:
I'll just add: Handling this case is basically impossible to do
sanely. You can't really know
On 06-07-2012 22:07, akaz wrote:
On Friday, 6 July 2012 at 15:39:40 UTC, Alex Rønne Petersen wrote:
On 06-07-2012 16:07, Denis Shelomovskij wrote:
06.07.2012 17:43, akaz пишет:
Hi,
Reading about the C++11, I stumbled upon this:
I'll just add: Handling this case is basically impossible to
On 06/07/2012 16:39, Alex Rønne Petersen wrote:
On 06-07-2012 16:07, Denis Shelomovskij wrote:
06.07.2012 17:43, akaz пишет:
Hi,
Reading about the C++11, I stumbled upon this:
http://www2.research.att.com/~bs/C++0xFAQ.html#gc-abi
Specifically (quote):
int* p = new int;
p+=10;
// ...
On Friday, 6 July 2012 at 21:10:56 UTC, Simon wrote:
On 06/07/2012 16:39, Alex Rønne Petersen wrote:
On 06-07-2012 16:07, Denis Shelomovskij wrote:
06.07.2012 17:43, akaz пишет:
Never mind what D says, even in C/C++ just doing the p += 10 is
invalid.
Creating a pointer that points at
Won't some functions doing just what addRange() and
removeRange() do solve that kind of problem (if necessary)?
That means, forbidding the GC to scan some memory area for some
time?
Like their C++11 counterparts:
void declare_reachable(void* p); // the region of memory
starting at p
On 07-07-2012 05:02, akaz wrote:
On Friday, 6 July 2012 at 21:10:56 UTC, Simon wrote:
On 06/07/2012 16:39, Alex Rønne Petersen wrote:
On 06-07-2012 16:07, Denis Shelomovskij wrote:
06.07.2012 17:43, akaz пишет:
Never mind what D says, even in C/C++ just doing the p += 10 is invalid.
Today I got the nice message
Error: undefined identifier missing
from DMD2.057/win and was baffled for several minutes until I
recognized the meaning.
-manfred
On 02/06/2012 08:20 PM, Manfred Nowak wrote:
Today I got the nice message
Error: undefined identifier missing
from DMD2.057/win and was baffled for several minutes until I
recognized the meaning.
-manfred
Single quotes would indeed be helpful.
32 matches
Mail list logo