[Webkit-unassigned] [Bug 98893] Replace (typeof(x) != <>) with !(typeof(x) == <>)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Oct 11 09:38:27 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=98893





--- Comment #8 from Filip Pizlo <fpizlo at apple.com>  2012-10-11 09:39:08 PST ---
(In reply to comment #7)
> Created an attachment (id=168242)
 --> (https://bugs.webkit.org/attachment.cgi?id=168242&action=review) [details]
> fixed patch
> 
> Thank you very much for a feedback.
> Is it codestyle violation?
> I didn't understand why 'else if' is necessary.

1) Style.  At first, since there wasn't an "else", it seemed like both 'if' statements could be taken, which is not the case.  It makes the code less clear on first glance.

2) Performance.  We care about it.  So even in code that isn't known to be hot (though all of the bytecode generator is hot and is subject to continuous interest from the standpoint of optimization), we aim to write the code in a way that will be naturally performant especially if it's super easy to do so - like making sure that the second branch isn't taken if the first one is (by using "else").

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list