On Wednesday, 15 July 2020 at 13:38:34 UTC, Cecil Ward wrote:
I recently noticed
pragma(inline, true)
which looks extremely useful. A couple of questions :
1. Is this cross-compiler compatible?
Works for LDC and DMD, not sure about GDC, but if it doesn't
support it, it's definitely on Iai
On Wednesday, 15 July 2020 at 13:38:34 UTC, Cecil Ward wrote:
I recently noticed
pragma(inline, true)
which looks extremely useful. A couple of questions :
1. Is this cross-compiler compatible?
2. Can I declare a function in one module and have it _inlined_
in another module at the call si
I recently noticed
pragma(inline, true)
which looks extremely useful. A couple of questions :
1. Is this cross-compiler compatible?
2. Can I declare a function in one module and have it _inlined_
in another module at the call site?
I’m looking to write functions that expand to approx one
On Fri, 25 Mar 2011 22:04:20 -0400, Caligo wrote:
T[3] data;
T dot(const ref Vector o){
return data[0] * o.data[0] + data[1] * o.data[1] + data[2] *
o.data[2];
}
T LengthSquared_Fast(){ return data[0] * data[0] + data[1] * data[1] +
data[2] * data[2]; }
T LengthSquared_Slow(){ return d
Jérôme M. Berger:
> Even with -ftree-vectorize?
Right.
> AFAIK it is considered experimental and
> needs to be turned on explicitly. Don't know how good it is though...
It's a very long lasting and complex experiment then :-) There is a lot of work
behind that little switch.
Modern co
bearophile wrote:
> I have not found a quick way to let GCC vectorize this code, using two
> multiplications with one SSE instructions, I am not sure GCC is able to do
> this automatically.
>
Even with -ftree-vectorize? AFAIK it is considered experimental and
needs to be turned on explic
Caligo:
> There shouldn't be a performance difference between the two, but there.
It seems the compiler isn't removing some useless code (the first has 3 groups
of movsd, the second has 4 of them):
v = v * 1.0012;
main:
L45:mov ESI,offset FLAT:_D4test6Vector6__initZ
I've changed my code since I posted this, so here is something
different that shows performance difference:
module t1;
struct Vector{
private:
double x = void;
double y = void;
double z = void;
public:
this(in double x, in double y, in double z){
this.x = x;
this.y = y;
this
This little test program:
struct Vector(T) {
T[3] data;
T dot(const ref Vector o) {
return data[0] * o.data[0] +
data[1] * o.data[1] +
data[2] * o.data[2];
}
T lengthSquaredSlow() {
return dot(this);
}
T lengthSquaredFast()
Answer for Jonathan M Davis and Caligo:
I far as I remember you need to use -finline-functions on GDC to perform
inlining.
-O3 implies inlining, on GCC, and I presume on GDC too.
Inlining is a complex art, the compilers compute a score for each function and
each function call and decide if per
On Sat, Mar 26, 2011 at 3:47 AM, Jonathan M Davis wrote:
> On 2011-03-26 01:06, Caligo wrote:
>> On Fri, Mar 25, 2011 at 11:56 PM, Jonathan M Davis
> wrote:
>> > On 2011-03-25 21:21, Caligo wrote:
>> >> On Fri, Mar 25, 2011 at 10:49 PM, Jonathan M Davis
>> >
>> > wrote:
>> >> > On 2011-03-25 19:
On 2011-03-26 01:06, Caligo wrote:
> On Fri, Mar 25, 2011 at 11:56 PM, Jonathan M Davis
wrote:
> > On 2011-03-25 21:21, Caligo wrote:
> >> On Fri, Mar 25, 2011 at 10:49 PM, Jonathan M Davis
> >
> > wrote:
> >> > On 2011-03-25 19:04, Caligo wrote:
> >> >> T[3] data;
> >> >>
> >> >> T dot(const
On Fri, Mar 25, 2011 at 11:56 PM, Jonathan M Davis wrote:
> On 2011-03-25 21:21, Caligo wrote:
>> On Fri, Mar 25, 2011 at 10:49 PM, Jonathan M Davis
> wrote:
>> > On 2011-03-25 19:04, Caligo wrote:
>> >> T[3] data;
>> >>
>> >> T dot(const ref Vector o){
>> >> return data[0] * o.data[0] + data
On 2011-03-25 21:21, Caligo wrote:
> On Fri, Mar 25, 2011 at 10:49 PM, Jonathan M Davis
wrote:
> > On 2011-03-25 19:04, Caligo wrote:
> >> T[3] data;
> >>
> >> T dot(const ref Vector o){
> >> return data[0] * o.data[0] + data[1] * o.data[1] + data[2] *
> >> o.data[2]; }
> >>
> >> T LengthSq
On Fri, Mar 25, 2011 at 10:49 PM, Jonathan M Davis wrote:
> On 2011-03-25 19:04, Caligo wrote:
>> T[3] data;
>>
>> T dot(const ref Vector o){
>> return data[0] * o.data[0] + data[1] * o.data[1] + data[2] * o.data[2];
>> }
>>
>> T LengthSquared_Fast(){ return data[0] * data[0] + data[1] * data[
On 2011-03-25 19:04, Caligo wrote:
> T[3] data;
>
> T dot(const ref Vector o){
> return data[0] * o.data[0] + data[1] * o.data[1] + data[2] * o.data[2];
> }
>
> T LengthSquared_Fast(){ return data[0] * data[0] + data[1] * data[1] +
> data[2] * data[2]; }
> T LengthSquared_Slow(){ return dot(t
T[3] data;
T dot(const ref Vector o){
return data[0] * o.data[0] + data[1] * o.data[1] + data[2] * o.data[2];
}
T LengthSquared_Fast(){ return data[0] * data[0] + data[1] * data[1] +
data[2] * data[2]; }
T LengthSquared_Slow(){ return dot(this); }
The faster LengthSquared() is twice as fast
17 matches
Mail list logo