On 07/08/2014 05:13 PM, Nordlöw wrote:
If I want randInPlace to take value arguments (such as structs) by
reference and reference types (classes) as normal is this
I don't understand what it means to fill a struct or a class object with
random content.
/** Generate Random Contents in $(D
Is it safe to assume that __VERSION__ is the same among DMD, LDC and GDC
when using the equivalent front-end? I want to implement @nogc in
Derelict in a backward compatible way. The simple thing to do is (at the
suggestion of w0rp):
static if( __VERSION__ 2.066 ) enum nogc = 1;
I just want
Mike Parker:
Is it safe to assume that __VERSION__ is the same among DMD,
LDC and GDC when using the equivalent front-end?
Right. An alternative solution is to use __traits(compiles) and
use @nogc inside it.
Bye,
bearophile
On 7/9/14, Mike Parker via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
Is it safe to assume that __VERSION__ is the same among DMD, LDC and GDC
when using the equivalent front-end?
Yes, but not all future compilers might implement this (although I
hope they will). I think
Hello,
I extracted a part of my code written in c.
it is deliberately useless here but I would understand the
different technics to optimize such kind of code with gdc
compiler.
it currently runs under a microsecond.
Constraint : the way the code is expressed cannot be changed much
we need
On Wednesday, 9 July 2014 at 10:57:33 UTC, Larry wrote:
Hello,
I extracted a part of my code written in c.
it is deliberately useless here but I would understand the
different technics to optimize such kind of code with gdc
compiler.
it currently runs under a microsecond.
Constraint : the
Larry:
Now the performance :
D : 12 µs
C : 1µs
Where does the diff comes from ? Is there a way to optimize the
d version ?
Again, I am absolutely new to D and those are my very first
line of code with it.
Your C code is not equivalent to the D code, there are small
differences, even
On Monday, 7 July 2014 at 22:00:51 UTC, Rainer Schuetze wrote:
On 07.07.2014 12:46, ParticlePeter wrote:
On Sunday, 6 July 2014 at 19:27:38 UTC, Rainer Schuetze wrote:
These object files are in the library ;-) That means manual
selection,
though, as incremental builds to multiple object
On Wednesday, 9 July 2014 at 12:25:40 UTC, bearophile wrote:
Larry:
Now the performance :
D : 12 µs
C : 1µs
Where does the diff comes from ? Is there a way to optimize
the d version ?
Again, I am absolutely new to D and those are my very first
line of code with it.
Your C code is not
On Wednesday, 9 July 2014 at 13:18:00 UTC, Larry wrote:
On Wednesday, 9 July 2014 at 12:25:40 UTC, bearophile wrote:
Larry:
Now the performance :
D : 12 µs
C : 1µs
Where does the diff comes from ? Is there a way to optimize
the d version ?
Again, I am absolutely new to D and those are my
On Wednesday, 9 July 2014 at 13:46:59 UTC, Larry wrote:
Yes you are perfectly right but our need is to run the fastest
code on the lowest powered machines. Not servers but embedded
systems.
That is why I just test the overall structures.
The rest of the code is numerical so it will not
@Bearophile: just tried. No dramatic change.
import core.memory;
void main() {
GC.disable;
...
}
Larry:
@Bearophile: just tried. No dramatic change.
import core.memory;
void main() {
GC.disable;
...
}
That just means disabling the GC, so the start time is the same.
What you want is to not start the GC/runtime, stubbing it out...
(assuming you don't need the GC in your program).
I
On Wednesday, 9 July 2014 at 13:46:59 UTC, Larry wrote:
The rest of the code is numerical so it will not change by much
the fact that d cannot get back the huge launching time. At the
microsecond level(even nano) it counts because of electrical
consumption, size of hardware, heat and so on.
On Wednesday, 9 July 2014 at 14:30:41 UTC, John Colvin wrote:
You say you are worried about microseconds and power
consumption, but you are suggesting launching a new process - a
lot of overhead - to do a small amount of numerical work.
Not much overhead if you don't use a MMU and use static
On Wed, Jul 09, 2014 at 07:51:24AM +0200, Philippe Sigaud via
Digitalmars-d-learn wrote:
On Tue, Jul 8, 2014 at 7:50 AM, H. S. Teoh via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote quite a wall of text
Wow, what to add to that? Maybe you scared other from participating
;-)
I
On Monday, 7 July 2014 at 23:47:26 UTC, Aerolite wrote:
Hey all,
I've not posted here in a while, but I've been keeping up to
speed with D's progress over the last couple of years and
remain consistently impressed with the language.
I'm part of a new computing society in the University of
I apologize many times for this question, may be this had already
been answered somewhere, but considering today the last of my
nerve is broken, I can not really find the soution.
So I have a D code, which acts as a central manager of all my
codes, reads user input, reads files, etc, and
On Wednesday, 9 July 2014 at 14:30:41 UTC, John Colvin wrote:
On Wednesday, 9 July 2014 at 13:46:59 UTC, Larry wrote:
The rest of the code is numerical so it will not change by
much the fact that d cannot get back the huge launching time.
At the microsecond level(even nano) it counts because
On Wednesday, 9 July 2014 at 15:09:09 UTC, Larry wrote:
On Wednesday, 9 July 2014 at 14:30:41 UTC, John Colvin wrote:
On Wednesday, 9 July 2014 at 13:46:59 UTC, Larry wrote:
The rest of the code is numerical so it will not change by
much the fact that d cannot get back the huge launching time.
On Wednesday, 9 July 2014 at 15:09:09 UTC, Larry wrote:
On Wednesday, 9 July 2014 at 14:30:41 UTC, John Colvin wrote:
On Wednesday, 9 July 2014 at 13:46:59 UTC, Larry wrote:
The rest of the code is numerical so it will not change by
much the fact that d cannot get back the huge launching time.
I may definitely help on the D project.
I noticed that gdc doesn't have profile guided optimization too.
So yeah, I cannot use D right now, I mean for this project.
Ok, I will do my best to have some spare time on Dlang. Didn't
really looked at the code already and I code for years in C,
On Wednesday, 9 July 2014 at 14:51:41 UTC, Meta wrote:
One of the uglier things in D is also a long-standing problem
with C and C++, in that comparison of signed and unsigned
values is allowed.
I would like that, if it would be implemented along this line:
/// Returns -1 if a b, 0 if they
Of course without the ! after opCmp in the several cases.
@Chris :
Actually yes. If we consider the device to run 20h a day, by
shaving a few microseconds there and there on billions of
operations a day over a whole machine park, you can enable
yourself to shut down some of them for maintenance more easily,
or pause some of them letting their
On Wed, Jul 09, 2014 at 04:24:38PM +, Dominikus Dittes Scherkl via
Digitalmars-d-learn wrote:
On Wednesday, 9 July 2014 at 14:51:41 UTC, Meta wrote:
One of the uglier things in D is also a long-standing problem with C
and C++, in that comparison of signed and unsigned values is allowed.
On Wednesday, 9 July 2014 at 17:13:21 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
On Wed, Jul 09, 2014 at 04:24:38PM +, Dominikus Dittes
Scherkl via Digitalmars-d-learn wrote:
/// Returns -1 if a b, 0 if they are equal or 1 if a b.
/// this will always yield a correct result, no matter
On Wednesday, 9 July 2014 at 17:13:21 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
For the comparison s u, where s is a signed value and u is an
unsigned
value, whenever s is negative, the return value of opCmp must be
negative. Assuming 2's-complement representation of integers,
this
On Wednesday, 9 July 2014 at 17:13:21 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
The branched version would look something like this:
mov eax, [address of u]
mov ebx, [address of s]
cmp ebx, $#0
jge label1 ; first branch
mov
On 07/09/2014 03:57 AM, Larry wrote:
struct timeval s,e;
[...]
gettimeofday(e,NULL);
printf(so ? %d %lu %d %d %d,g,e.tv_usec - s.tv_usec,
arr[4],arr[9],pol);
Changing the topic a little, the calculation above ignores the tv_sec
members of s and e.
Ali
On Wed, Jul 09, 2014 at 05:43:15PM +, Dominikus Dittes Scherkl via
Digitalmars-d-learn wrote:
On Wednesday, 9 July 2014 at 17:13:21 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
[..]
Yeah, I don't see what's the problem with comparing signed and unsigned
values, as long as the result is
On Wednesday, 9 July 2014 at 18:18:43 UTC, Ali Çehreli wrote:
On 07/09/2014 03:57 AM, Larry wrote:
struct timeval s,e;
[...]
gettimeofday(e,NULL);
printf(so ? %d %lu %d %d %d,g,e.tv_usec - s.tv_usec,
arr[4],arr[9],pol);
Changing the topic a little, the calculation above
On Wed, Jul 09, 2014 at 11:29:06AM -0700, H. S. Teoh via Digitalmars-d-learn
wrote:
On Wed, Jul 09, 2014 at 05:43:15PM +, Dominikus Dittes Scherkl via
Digitalmars-d-learn wrote:
On Wednesday, 9 July 2014 at 17:13:21 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
[...]
Often, such
Hello,
I'm looking to introspect a module, list all the members, iterate
over them and filter them by kind inside of a static constructor.
This is in the hope of shortening some hand-written code that is
quite repetitive (adding many struct instances to an associative
array in a static
On Wed, 09 Jul 2014 20:07:56 +, NCrashed wrote:
On Wednesday, 9 July 2014 at 20:04:47 UTC, Maxime Chevalier-Boisvert
wrote:
auto members = [__traits(allMembers, ir.ir)];
pragma(msg, members);
Have you tried without quotes?
pragma(msg, __traits(allMembers, ir.ir));
Also, looks like it
On Wednesday, 9 July 2014 at 20:07:57 UTC, NCrashed wrote:
Produces:
ir/iir.d(85): Error: argument has no members
If module name is ir.iir: pragma(msg, __traits(allMembers,
ir.iir));
On Wednesday, 9 July 2014 at 20:07:57 UTC, NCrashed wrote:
On Wednesday, 9 July 2014 at 20:04:47 UTC, Maxime
Chevalier-Boisvert wrote:
auto members = [__traits(allMembers, ir.ir)];
pragma(msg, members);
Have you tried without quotes?
pragma(msg, __traits(allMembers, ir.ir));
Did need to
I got the following code to do what I want:
static this()
{
void addOp(ref Opcode op)
{
assert (
op.mnem !in iir,
duplicate op name ~ op.mnem
);
iir[op.mnem] = op;
}
foreach (memberName; __traits(allMembers, ir.ops))
{
On Wednesday, 9 July 2014 at 20:52:29 UTC, Maxime
Chevalier-Boisvert wrote:
It's a bit of a hack, but it works. Is there any way to create
some sort of alias for __traits(getMember, ir.ops, memberName)
so that I don't have to write it out in full twice? Made some
attempts but only got the
On 07/09/2014 12:47 PM, Larry wrote:
On Wednesday, 9 July 2014 at 18:18:43 UTC, Ali Çehreli wrote:
On 07/09/2014 03:57 AM, Larry wrote:
struct timeval s,e;
[...]
gettimeofday(e,NULL);
printf(so ? %d %lu %d %d %d,g,e.tv_usec - s.tv_usec,
arr[4],arr[9],pol);
Changing
On Tuesday, 8 July 2014 at 20:50:01 UTC, Nordlöw wrote:
I recall that Python's default sorting algorithm is related to
this, right?
https://en.wikipedia.org/wiki/Timsort
On Tuesday, 8 July 2014 at 20:50:01 UTC, Nordlöw wrote:
Also related:
http://forum.dlang.org/thread/eaxcfzlvsakeucwpx...@forum.dlang.org#post-mailman.2809.1355844427.5162.digitalmars-d:40puremagic.com
Right
Measure a larger number of loops. I understand you're concerned
about microseconds, but your benchmark shows nothing because your
timer is simply not accurate enough for this. The benchmark that
bearophile showed where C took ~2 nanoseconds vs the ~7000 D took
heavily implies to me that the C
On Wednesday, 9 July 2014 at 13:18:00 UTC, Larry wrote:
You are definitely right, I did mess up while translating !
I run the corrected codes (the ones I was meant to provide :S)
and on a slow macbook I end up with :
C : 2
D : 15994
Of course when run on very high end machines, this diff is
The actual code is not that much slower according to the numerous
other operations we do. And certainly faster than D version doing
almost nothing.
Well it is about massive bitshifts and array accesses and
calculations.
With all the optimizations we are on par with fortran numerical
code
46 matches
Mail list logo