Timeline for Can "return this" pattern be optimized to no cost performance?
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 29, 2016 at 13:59 | comment | added | svick |
@Jules Sure, I was objecting to the assertion in the question that return this is always worse. I'm just claiming that in some circumstances, it can be better, not that it's always better.
|
|
| Jan 29, 2016 at 7:55 | comment | added | Jules | @svick But the receiver does need to save the value, which may decrease performance. | |
| Jan 28, 2016 at 20:01 | comment | added | svick |
@greenoldman It can, I tried to explain this: with return this, the caller doesn't have to remember the object, thus saving one variable/register, which can increase performance.
|
|
| Jan 28, 2016 at 19:58 | comment | added | greenoldman |
Thank you, but you forgetting something "I believe the return this pattern has a potential to be more efficient". It cannot be even more efficient than no return this.
|
|
| Jan 28, 2016 at 19:50 | history | answered | svick | CC BY-SA 3.0 |