Re: [webkit-dev] Preferred style for checking for undefined in our built-in JavaScript code?

2015-11-30 Thread Chris Aljoudi
FWIW, performance seems to be equivalent:
http://jsperf.com/typeof-vs-undefined-check/39

Chris
https://chrismatic.io/

> On Nov 30, 2015, at 1:01 PM, Geoffrey Garen  wrote:
>
> For the time being, I like “x === undefined”.
>
> Long term, I’d like us to switch to “x === @undefined”.
>
> We use @ to indicate reserved words in built-ins. Currently, “@undefined" 
> does not exist, but the built-in compiler magically transforms “undefined” a 
> safe reserved word.
>
> The typeof and void 0 code should be fast, but I find it obtuse.
>
> Geoff
>
>> On Nov 30, 2015, at 11:39 AM, Filip Pizlo  wrote:
>>
>> I’ve also been guilty of:
>>
>>if (xxx === void 0)
>>
>> This is slightly better than saying “undefined”, since that’s not actually a 
>> reserved word.
>>
>> I believe that all of these should perform the same.  We should pick one 
>> based on what looks nicest and what has the most clear semantics.
>>
>> -Filip
>>
>>
>>
>>> On Nov 30, 2015, at 11:37 AM, Darin Adler  wrote:
>>>
>>> I see the following in some code:
>>>
>>>  if (xxx === undefined)
>>>
>>> And I see the following in some other code:
>>>
>>>  if (typeof xxx == “undefined”)
>>>
>>>  or
>>>
>>>  if (typeof xxx === “undefined”)
>>>
>>> Is one preferred over the other, style-wise? Is one more efficient than the 
>>> other?
>>>
>>> — Darin
>>> ___
>>> webkit-dev mailing list
>>> webkit-dev@lists.webkit.org
>>> https://lists.webkit.org/mailman/listinfo/webkit-dev
>>
>> ___
>> webkit-dev mailing list
>> webkit-dev@lists.webkit.org
>> https://lists.webkit.org/mailman/listinfo/webkit-dev
>
> ___
> webkit-dev mailing list
> webkit-dev@lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


[webkit-dev] High web process CPU usage

2016-07-20 Thread Chris Aljoudi
Hi all,

In the Safari shipped with the latest macOS Sierra beta, as well as Safari Tech 
Preview 9, there's an odd CPU usage issue with individual tab's web processes.

For example, if one navigates to huffingtonpost.com 
, Activity Monitor will show the tab web process 
continually using 5-10% of CPU, along with hundreds of idle wake-ups. Even more 
concerning, this continues to happen with the huffingtonpost.com 
 web process even if one picks another tab in the 
window.

Here's a screenshot from Activity Monitor; one Safari window is open. It has 
two tabs: polymail.io , and about:blank . 
about:blank  is the one currently in focus.



To investigate, I opened Web Inspector and recorded the JS/event timeline. I 
found that there were timers firing quite frequently.

Now, I know Safari/WebKit should be throttling timers of background tabs 
anyway, but I figured I'd `clearInterval` all the timers to see if that reduces 
the CPU usage. Nope (even though I verified no timers are firing any longer 
after clearing all the intervals — no activity on the timeline whatsoever; CPU 
usage and idle wake ups still way too high).

This doesn't happen with *every* page, but it happens with most that are 
reasonably complex (can't tell what the trigger is yet; perhaps the use of 
JavaScript timers?)

The previous Sierra beta's Safari and Tech Preview 8 both showed this problem. 
I don't know whether it goes further back.

Any ideas what's going on? Is this 'expected behavior' and I'm missing 
something obvious?

Thanks,
Chris___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev