this vs this again

Benchmark created by me on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">






</script>

Test runner

Ready to run.

Testing in
TestOps/sec
$(this)
var process = function ($carousels) {
    var options;

    $carousels.each(function () {
        if ($(this).is('[data-mobile-slick-carousel]')) {
            options = $(this).data('mobileSlickCarousel');
        } else if ($(this).is('[data-slick-carousel]')) {
            options = $(this).data('slickCarousel');
        }
    });
};

process($('.container'));
ready
this
var process = function ($carousels) {
    var options;

    $carousels.each(function () {

        var carousel = $(this);

        if (carousel.is('[data-mobile-slick-carousel]')) {
            options = carousel.data('mobileSlickCarousel');
        } else if (carousel.is('[data-slick-carousel]')) {
            options = carousel.data('slickCarousel');
        }
    });
};

process($('.container'));
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.