I have noticed that Facebook's XFBML like button adds a timer that triggers every 100ms. Does anyone knows why? Also, is it possible to remove this timer?
I think this is a bug because 100ms means it fired very often. Also, if you have 10 like buttons you will have 10 triggers fired every 100ms, 100 triggers per second. That's a lot and can causes some performance problems.
You can check this in Chrome by opening: http://mashable.com/ (they have a lot of like buttons) Then just open developers tools and from timeline tab do a record. You will see a lot of Timer fired (see snapshot http://cl.ly/272h3V1u1t3w0f1R4625).
Looks to me as if each like button sets up it's own polling to keep updated instead of setting up a small pubsub architecture where it only has one timer polling and alerting any subscribers.
So I'd simply discard this as a bad implementation on facebooks part and take it up with them to rewrite it.
Pubsub is really not that difficult to implement. Just take a look at this implementation: https://github.com/daniellmb/MinPubSub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With