Tag Archives: Application programming interface

JQuery Performance Tests – Bazaar

JQuery is currently the most popular JavaScript library on the world. Therefore apparently everybody seems to be an expert on it.

I just spend some time reading articles from ‘experts’ and what they advise you to do.

NB! All tests which follow are executed on the 3 browsers: Chrome 35, IE 11 and Firefox 30-32.

1. $(“#id”).find(“p”); JQuery performance is 2 times faster than $(“#id p”); .

After running tests on those 2 I can conclude only that he must be one passionate  IE user :)

For the 2 other browsers the process time for the both functions is nearly the same.

For those who want to try the test on their own: http://jsperf.com/jquery-performance-test-2

 

2. Learn the entire library.

The example that was given in this article to support this theory was the following.

You shouldn’t use that:

a.hasClass('b') ? a.removeClass('b') : a.addClass('b');

You should use that:

a.toggleClass('b');

I agree that the second one is obviously shorter but that is pretty much all advantages to it.

Let’s prove it though instead of leaving empty statements in the air.

I run the both pieces of code in 3 browsers and here is the results.

The JQuery performance for all browsers is better with the manual and add/remove of class functionality than the toggle one.

Here is the actual test so you can try it on your own: http://jsperf.com/jquery-toggle-class-test

3. $(“#id p”);  performs faster than $(“p”);

The only browser on which that is true is Chrome. And in IE actually $(“p”); performs much better.

Here is the test http://jsperf.com/jquery-single-vs-nested-description

4. Id vs Class selectors vs HTMLselectors

This one is really old advice from the time when JavaScript was still not popular and the experts on it weren’t that many.

Since JQuery is built on JavaScript we would only expect that the  JQuery performance for IDs should be also the fastest.

In this test we have clearly faster ID search for all the browsers.

On second place is the class selector and the last place remains for the HTML selectors.

Mandrill webhooks troubleshooting

mandrill webhooksThis article provides advices for easier testing on custom applications integrated with Mandrill Webhooks.

Mandrill is transactional email platform created from the popular email subscription ‘newsletter’ service Mailchimp. Mandrill is competitor of services like Sendgrid, Mailjet and etc. By far is the cheapest and most flexible solution out there. Furthermore due the fact that it is relatively new it still gets new features every day.

 

 

Mandrill supports two ways for sending emails:

On the other end there are Mandrill Webhooks. 

Mandrill Webhooks pushes events (send, open, click) back to chosen from you URL. That makes possible for you to keep track on the email status.

Two things about Mandrill Webhooks that is nice to know in advance:

  • They don’t support email ‘delivery’ event.
  • All events are normally fired with 7-10 minutes delay.

Test Mandrill Webhooks in couple easy steps:

1. Save all possible RAW HTTP requests that Mandrill can send.

Use RequestBin for that.

RequestBin  provides you with temporary URL on which you can submit HTTP requests.  On the same RequestBin URL you will be able to preview all the submitted requests.

requestbin

2. Import the requests in Postman.

Postman is extremely cool and easy Google Chrome Extension. It is used for testing REST web services and ordinary HTTP requests.

The nice really thing about this solution in comparison with APIKitchen and Hurl is the possibility to store and order your request structure.

As user interface Postman resembles Hurl. Besides the ordinary Parameter/Value input that you can have in both Hurl and Postman, in Postman there is also possibility to use ‘Raw’ requests. This functionality is really handy when you need to copy already existing query source from RequestBin, for example. Unfortunately the syntax of the Raw request is often harder to comprehend. Furthermore unfortunately the Form-data (Parameter/Value) and the ‘Raw’ data are not synchronized.  Therefore if values are added in both tabs you will end up with two completely different requests.

postman

You can use this apps for all kind of developing, testing or debugging. They will definitely safe you hours during the process.