Last modified: 2012-11-07 04:28:14 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T31432, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 29432 - Use __METHOD__ / __FUNCTION__ instead of hardcoding function names in SemanticMediaWiki
Use __METHOD__ / __FUNCTION__ instead of hardcoding function names in Semant...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized minor (vote)
: ---
Assigned To: Markus Krötzsch
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-06-16 13:56 UTC by Sam Reed (reedy)
Modified: 2012-11-07 04:28 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Sam Reed (reedy) 2011-06-16 13:56:04 UTC
Looking through a lot of the SMW code you're customly building function names

What's wrong with __METHOD__/__FUNCTION__



Simiarily, wfProfileIn( "SMWSQLStore2::getInProperties (SMW)" );

Do you need to add the "(SMW)"?? And why are you hard coding those anyway?
Comment 1 Sam Reed (reedy) 2011-06-16 13:57:50 UTC
And if the rest of the SM* extensions do the same, please clean those up aswell
Comment 2 Sam Reed (reedy) 2011-06-16 13:59:54 UTC
I had a quick scan over the select() calls, and only found one not passing anything

Added in r90200

Can you evaluate any other DB methods that you're not passing them, and please add them too
Comment 3 Markus Krötzsch 2011-06-17 09:38:52 UTC
The reason why "(SMW)" was added was that this simplifies getting an overview of all SMW-related code blocks among the large amount of profiling data. There does not seem to be another way of filtering profiling by extension, and this is important for a big extension like SMW.

In general, I am inclined to close this as invalid or at least wontfix. Clearly, we are discussing a detail of coding style here that should not have any impact on observable program behavior. Moreover, it is not so clear that the proposed change is an improvement at all. I the can see that the use of __METHOD__ etc. could be considered preferable regarding code style, but OTOH the use of string construction functions in frequent profiling calls (to add "(SMW)") could be considered harmful for performance (since parameter construction costs apply even if profiling is disabled). I appreciate efforts to implement clean coding conventions, but looking at the code of SMW and MW, I wonder if this issue is anywhere near the top of things to bother about in this respect.

(This does not affect the unrelated comment on select; these should obviously have provenance information attached in all cases.)
Comment 4 Andrew Garrett 2011-06-22 00:29:42 UTC
(In reply to comment #3)
> The reason why "(SMW)" was added was that this simplifies getting an overview
> of all SMW-related code blocks among the large amount of profiling data. There
> does not seem to be another way of filtering profiling by extension, and this
> is important for a big extension like SMW.

If you want filterability, prefix with SMW- instead of suffixing with (SMW). It adds a nice expando-box on profileinfo.php. This will mess up sorting, though (they're all grouped together), so it may or may not actually be a good idea.

> In general, I am inclined to close this as invalid or at least wontfix.
> Clearly, we are discussing a detail of coding style here that should not have
> any impact on observable program behavior.

I tend to agree.

> Moreover, it is not so clear that
> the proposed change is an improvement at all. I the can see that the use of
> __METHOD__ etc. could be considered preferable regarding code style, but OTOH
> the use of string construction functions in frequent profiling calls (to add
> "(SMW)") could be considered harmful for performance (since parameter
> construction costs apply even if profiling is disabled).

That performance cost is minuscule and can be safely ignored. There's no need to prematurely optimise that.
Comment 5 MWJames 2012-06-08 23:52:50 UTC
It is over a year that this request was discussed, can we close this one?

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links