this(this) / opAssign

monarch_dodra monarchdodra at gmail.com
Thu Jan 10 16:02:47 PST 2013


On Thursday, 10 January 2013 at 23:35:19 UTC, Namespace wrote:
> On Thursday, 10 January 2013 at 23:30:35 UTC, monarch_dodra 
> wrote:
>> On Thursday, 10 January 2013 at 23:03:30 UTC, Namespace wrote:
>>> And what should I use, this(this) or opAssign? I thougth that 
>>> it is unimportant,
>>> but that changed my mind: http://dpaste.dzfl.pl/36ce3688
>>
>> BTW, answered to the best of my abilities, taking into account 
>> your link expired, so I don't have as much context as you 
>> tried to offer.
>
> It is private, sorry.
> Here as public: http://dpaste.dzfl.pl/ab3c7a5c

Yeah, but if you re-arrange the tests, then you get opposite 
results...
http://dpaste.dzfl.pl/fork/c52f290a

Benchmarking is hard.

You could try maybe viewing the disassembly instead?
http://d.godbolt.org/#{%22version%22%3A3%2C%22filterAsm%22%3A{%22labels%22%3Atrue%2C%22directives%22%3Atrue%2C%22commentOnly%22%3Atrue%2C%22colouriseAsm%22%3Atrue}%2C%22compilers%22%3A[{%22source%22%3A%22\nstruct%20Avec2f%20{\npublic%3A\n\tfloat%20x%2C%20y%3B\n\t\n\tref%20Avec2f%20opAssign%28const%20ref%20Avec2f%20v%29%20{\n\t\tthis.x%20%3D%20v.x%3B\n\t\tthis.y%20%3D%20v.y%3B\n\t\t\n\t\treturn%20this%3B\n\t}\n}\n\nstruct%20Bvec2f%20{\npublic%3A\n\tfloat%20x%2C%20y%3B\n\t\n}\n\nstruct%20Cvec2f%20{\npublic%3A\n\tfloat%20x%2C%20y%3B\n\t\n\tthis%28this%29%20{\n\t\tthis.x%20%3D%20x%3B\n\t\tthis.y%20%3D%20y%3B\n\t}\n}\n\nvoid%20main%28%29\n{\t\n\tAvec2f%20v1%20%3D%20Avec2f%284%2C%202%29%3B\n\tAvec2f%20v2%20%3D%20Avec2f%286%2C%208%29%3B\n\tv1%20%3D%20v2%3B\n\t\n\tBvec2f%20v3%20%3D%20Bvec2f%284%2C%202%29%3B\n\tBvec2f%20v4%20%3D%20Bvec2f%286%2C%208%29%3B\n\tv3%20%3D%20v4%3B\n\n\tCvec2f%20v5%20%3D%20Cvec2f%284%2C%202%29%3B\n\tCvec2f%20v6%20%3D%20Cvec2f%286%2C%208%29%3B\n\tv5%20%3D%20v6%3B\n}%22%2C%22compiler%22%3A%22%2Fusr%2Fbin%2Fgdc%22%2C%22options%22%3A%22-O2%20-march%3Dnative%22}]}



More information about the Digitalmars-d-learn mailing list