[Wikitech-l] Re: Goto for microoptimisation

2021-08-14 Thread Robin Hood
: [Wikitech-l] Re: Goto for microoptimisation For the record, I merged Tim's patch<https://gerrit.wikimedia.org/r/c/mediawiki/core/+/708880/> last week and was unaware of this email thread. My thinking was as follows: 1. The implementation does not depend on the goto sta

[Wikitech-l] Re: Goto for microoptimisation

2021-08-13 Thread Physikerwelt
Just to play the devils advocate. I want to point out some example risks (which were of course included in the discussion in the earlier linked literature): a) someone will introduce if ($x==1.5) in the middle or b) someone will make action1 modifying on $x which might result in $x==2 the

[Wikitech-l] Re: Goto for microoptimisation

2021-08-13 Thread Krinkle
For the record, I merged Tim's patch last week and was unaware of this email thread. My thinking was as follows: 1. The implementation does not depend on the goto statement. That is, it is not used to write overly-clever or complicated

[Wikitech-l] Re: Goto for microoptimisation

2021-08-02 Thread Robin Hood
, 2021 4:55 AM To: wikitech-l@lists.wikimedia.org Subject: [Wikitech-l] Re: Goto for microoptimisation On 7/31/21 6:09 AM, Tim Starling wrote: > Certain flow control patterns cannot be implemented efficiently in PHP > without using "goto". The current example in Gerrit

[Wikitech-l] Re: Goto for microoptimisation

2021-08-02 Thread Adam Wight
On 7/31/21 6:09 AM, Tim Starling wrote: > Certain flow control patterns cannot be implemented efficiently in PHP without using "goto". The current example in Gerrit 708880 comes down to: If `goto` really does

[Wikitech-l] Re: Goto for microoptimisation

2021-08-01 Thread Bill Pirkle
I notice that sonarqubebot complains about the goto, and the reviewer suggests adding "// NOSONAR" to suppress that. I suggest we retain that behavior (frankly I'm not familiar enough with sonarqubebot to know if we could globally suppress it if we wanted to...) I don't object to a (very) limited

[Wikitech-l] Re: Goto for microoptimisation

2021-08-01 Thread Tim Starling
On 1/8/21 4:04 pm, rupert THURNER wrote: > you triggered me reading more about it though. the commit comment > states it takes 30% less instructions: > Measuring instruction count per iteration with perf stat, averaged over > 10M iterations, PS1. Test case: > Html::openElement('a', [ 'class'

[Wikitech-l] Re: Goto for microoptimisation

2021-08-01 Thread Amir Sarabadani
It might be interesting to point out to discussions around use of goto in Linux Kernel: https://koblents.com/Ches/Links/Month-Mar-2013/20-Using-Goto-in-Linux-Kernel-Code/ https://www.kernel.org/doc/html/v4.10/process/coding-style.html#centralized-exiting-of-functions IIRC (from a presentation by

[Wikitech-l] Re: Goto for microoptimisation

2021-08-01 Thread rupert THURNER
On Sat, Jul 31, 2021 at 6:10 AM Tim Starling wrote: > > For performance sensitive tight loops, such as parsing and HTML construction, > to get the best performance it's necessary to think about what PHP is doing > on an opcode by opcode basis. ... > I am proposing > > if ( $x == 1 ) { >

[Wikitech-l] Re: Goto for microoptimisation

2021-07-31 Thread Roy Smith
https://xkcd.com/292/ ___ Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/

[Wikitech-l] Re: Goto for microoptimisation

2021-07-31 Thread Bryan Davis
On Fri, Jul 30, 2021 at 10:10 PM Tim Starling wrote: > > For performance sensitive tight loops, such as parsing and HTML construction, > to get the best performance it's necessary to think about what PHP is doing > on an opcode by opcode basis. > > Certain flow control patterns cannot be