Re: [Wikitech-l] wfRunHooks deprecation
On Thu Jan 22 2015 at 1:10:27 PM Bryan Davis wrote: > On Thursday, January 22, 2015, Mark A. Hershberger > wrote: > > > Legoktm > writes: > > > > > On 01/21/2015 09:39 AM, Jeroen De Dauw wrote: > > >> Hey, > > >> > > >> Does the new syntax offer any advantage over the old one? > > > > > > It's a little bit faster by cutting down one function call which adds > up > > > when a lot of hooks are called. > > > > "adds up" is a poor defense for creating work for end users and > > developers. Has anyone actually measured what the difference is or is > > this just an example of premature optimization[1]? > > > > Mark. > > > > Footnotes: > > [1] http://en.wikipedia.org/wiki/Program_optimization#When_to_optimize > > > > I don't have before/after measurements but Aaron started changing from > wfRunHooks to direct Hook calls based on data gathered from WMF production > profiling. There was a non-trivial performance impact of the additional > layer of indirection. > > Sure, but obvious performance gains are obvious. The real question to me is "was moving it into a static function inside of Hooks a benefit over it just being a global function?" My guess is no, not really. -Chad ___ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Re: [Wikitech-l] wfRunHooks deprecation
On Thursday, January 22, 2015, Mark A. Hershberger wrote: > Legoktm > writes: > > > On 01/21/2015 09:39 AM, Jeroen De Dauw wrote: > >> Hey, > >> > >> Does the new syntax offer any advantage over the old one? > > > > It's a little bit faster by cutting down one function call which adds up > > when a lot of hooks are called. > > "adds up" is a poor defense for creating work for end users and > developers. Has anyone actually measured what the difference is or is > this just an example of premature optimization[1]? > > Mark. > > Footnotes: > [1] http://en.wikipedia.org/wiki/Program_optimization#When_to_optimize > > I don't have before/after measurements but Aaron started changing from wfRunHooks to direct Hook calls based on data gathered from WMF production profiling. There was a non-trivial performance impact of the additional layer of indirection. Bryan -- Bryan Davis Wikimedia Foundation [[m:User:BDavis_(WMF)]] Sr Software EngineerBoise, ID USA irc: bd808v:415.839.6885 x6855 ___ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Re: [Wikitech-l] wfRunHooks deprecation
Legoktm writes: > On 01/21/2015 09:39 AM, Jeroen De Dauw wrote: >> Hey, >> >> Does the new syntax offer any advantage over the old one? > > It's a little bit faster by cutting down one function call which adds up > when a lot of hooks are called. "adds up" is a poor defense for creating work for end users and developers. Has anyone actually measured what the difference is or is this just an example of premature optimization[1]? Mark. Footnotes: [1] http://en.wikipedia.org/wiki/Program_optimization#When_to_optimize -- Mark A. Hershberger NicheWork LLC 717-271-1084 ___ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Re: [Wikitech-l] wfRunHooks deprecation
On 01/21/2015 09:39 AM, Jeroen De Dauw wrote: > Hey, > > Does the new syntax offer any advantage over the old one? It's a little bit faster by cutting down one function call which adds up when a lot of hooks are called. -- Legoktm ___ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Re: [Wikitech-l] wfRunHooks deprecation
They probably could turn that global class into "facade" - compact form of IoC container Laravel framework uses. Dmitriy On Thu, Jan 22, 2015 at 12:51 AM, Brian Wolff wrote: > On Jan 21, 2015 1:40 PM, "Jeroen De Dauw" wrote: > > > > Hey, > > > > Does the new syntax offer any advantage over the old one? > > > Assuming that we want to switch to non-static function calls eventually > > > (which I hope is the case), wouldn't it be friendlier towards extension > > > maintainers to only deprecate once we are there, instead of forcing > them to > > > update twice? > > > > > > > Good points and questions. While this deprecation is not as problematic > as > > simply ditching the current hook system altogether, it does indeed seem a > > bit of busy work. > > > > The Hooks class has this comment "Used to supersede $wgHooks, because > > globals are EVIL.", which is quite amusing if you consider all fields and > > methods are static. So it's a switch from a global var to a global field, > > thus adding a second global to get rid of the first one. I have this > > presentation on static code which has a screenshot of this comment and > > class in it :) > > > > Cheers > > > > -- > > Jeroen De Dauw - http://www.bn2vs.com > > Software craftsmanship advocate > > Evil software architect at Wikimedia Germany > > ~=[,,_,,]:3 > > Ill be honest i dont understand the point of deprecating that. As you say > the evil globalness is the same amount of evil regardless of the type of > global symbol. And really i dont think global hooks causes too many > problems. > > --bawolff > ___ > Wikitech-l mailing list > Wikitech-l@lists.wikimedia.org > https://lists.wikimedia.org/mailman/listinfo/wikitech-l > ___ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Re: [Wikitech-l] wfRunHooks deprecation
On Jan 21, 2015 1:40 PM, "Jeroen De Dauw" wrote: > > Hey, > > Does the new syntax offer any advantage over the old one? > > Assuming that we want to switch to non-static function calls eventually > > (which I hope is the case), wouldn't it be friendlier towards extension > > maintainers to only deprecate once we are there, instead of forcing them to > > update twice? > > > > Good points and questions. While this deprecation is not as problematic as > simply ditching the current hook system altogether, it does indeed seem a > bit of busy work. > > The Hooks class has this comment "Used to supersede $wgHooks, because > globals are EVIL.", which is quite amusing if you consider all fields and > methods are static. So it's a switch from a global var to a global field, > thus adding a second global to get rid of the first one. I have this > presentation on static code which has a screenshot of this comment and > class in it :) > > Cheers > > -- > Jeroen De Dauw - http://www.bn2vs.com > Software craftsmanship advocate > Evil software architect at Wikimedia Germany > ~=[,,_,,]:3 Ill be honest i dont understand the point of deprecating that. As you say the evil globalness is the same amount of evil regardless of the type of global symbol. And really i dont think global hooks causes too many problems. --bawolff ___ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Re: [Wikitech-l] wfRunHooks deprecation
Hey, Does the new syntax offer any advantage over the old one? > Assuming that we want to switch to non-static function calls eventually > (which I hope is the case), wouldn't it be friendlier towards extension > maintainers to only deprecate once we are there, instead of forcing them to > update twice? > Good points and questions. While this deprecation is not as problematic as simply ditching the current hook system altogether, it does indeed seem a bit of busy work. The Hooks class has this comment "Used to supersede $wgHooks, because globals are EVIL.", which is quite amusing if you consider all fields and methods are static. So it's a switch from a global var to a global field, thus adding a second global to get rid of the first one. I have this presentation on static code which has a screenshot of this comment and class in it :) Cheers -- Jeroen De Dauw - http://www.bn2vs.com Software craftsmanship advocate Evil software architect at Wikimedia Germany ~=[,,_,,]:3 ___ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Re: [Wikitech-l] wfRunHooks deprecation
On Tue, Jan 20, 2015 at 4:21 PM, Chad wrote: > > I just noticed wfRunHooks got deprecated. The hook mechanism is heavily > > depended on by extensions. So if it is going away, what will it be > replaced > > by? There is no hint of this in the method doc. > > > Hooks::run(). > Does the new syntax offer any advantage over the old one? Assuming that we want to switch to non-static function calls eventually (which I hope is the case), wouldn't it be friendlier towards extension maintainers to only deprecate once we are there, instead of forcing them to update twice? ___ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Re: [Wikitech-l] wfRunHooks deprecation
Hey, > Hooks::run() Oh, in that case there is not much to worry about. Added a note in https://gerrit.wikimedia.org/r/#/c/186115/1/includes/GlobalFunctions.php Cheers -- Jeroen De Dauw - http://www.bn2vs.com Software craftsmanship advocate Evil software architect at Wikimedia Germany ~=[,,_,,]:3 ___ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Re: [Wikitech-l] wfRunHooks deprecation
On 2015-01-20 4:21 PM, Chad wrote: > On Tue Jan 20 2015 at 4:20:47 PM Jeroen De Dauw > wrote: > >> Hey, >> >> I just noticed wfRunHooks got deprecated. The hook mechanism is heavily >> depended on by extensions. So if it is going away, what will it be replaced >> by? There is no hint of this in the method doc. >> >> > Hooks::run(). > > -Chad Heh, yay. To bad we're not deprecating $wgHooks -> Hooks::register. I've had ideas that are impossible to do with $wgHooks. ((IIRC it was something about storing a light stack in debug mode of where Hooks::register is called so hook related errors, deprecation notices, etc... (or it might have been for a different kind of error) can actually tell you where the hook was registered)) ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/] ___ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Re: [Wikitech-l] wfRunHooks deprecation
On Tue Jan 20 2015 at 4:20:47 PM Jeroen De Dauw wrote: > Hey, > > I just noticed wfRunHooks got deprecated. The hook mechanism is heavily > depended on by extensions. So if it is going away, what will it be replaced > by? There is no hint of this in the method doc. > > Hooks::run(). -Chad ___ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
[Wikitech-l] wfRunHooks deprecation
Hey, I just noticed wfRunHooks got deprecated. The hook mechanism is heavily depended on by extensions. So if it is going away, what will it be replaced by? There is no hint of this in the method doc. Cheers -- Jeroen De Dauw - http://www.bn2vs.com Software craftsmanship advocate Evil software architect at Wikimedia Germany ~=[,,_,,]:3 ___ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l