Twitter Bootstrap: Performance comparison between Data Attribute and Programmatic APIs?
dom, javascript, twitter-bootstrap
Solution
I tried
$(document).ready(function() {
$('body').off('.data-api');
});
on javascript.html (where all the javascript plugin are called) downloaded here : https://github.com/twitter/bootstrap/zipball/master
data-api off:
there's 16026 calls and it takes 226.998ms
data-api on (original file):
same number of calls and it takes approximately the same time
Conclusion
The difference is marginal despite the page containing all the twitter bootstrap jquery plugins.
I think it's definitely more a matter of good practice than a big optimisation in term of performance.
Problem
According to this, the data-attribute API isn't always the most performant. Have you noticed significant improvements by switching from data-attribute to programmatic api ?