Friday, June 19, 2009

GWT / AJAX Performance Tools

Performance is important in your Web applications, especially in your client code. If you're a GWT user, I wanted to highlight a particularly useful benchmarking library - Jiffy and it's Firebug counterpart. It is the case that Safari's developer tools and Firebug by itself make user-injected benchmarking code less relevant for macro-benchmarks. But, if you're interested in fine-grained measurements and creating a rolling log of them, I found the developer tools a bit lacking.

Benchmarking is really just about specifying two points - a start and a stop. Giving that benchmark a label can be useful, and being able to review logs of these benchmarks over time would also be nice. Jiffy does all of this, with minimal setup time, and if you install the Firebug plugin, very immediate results.

First I downloaded the jiffy.js source and plugged this script tag into the HEAD of my GWT application's main HTML page:

script language="javascript" type="text/javascript" src="jiffy.js"

Then I created this simple class to wrap the required Jiffy calls as Java methods:

public class JiffyUtils {
public native static void mark(String markerName) /*-{
if( $wnd.Jiffy )
$wnd.Jiffy.mark(markerName);
}-*/;

public native static void measure(String measurementName, String markerName) /*-{
if( $wnd.Jiffy )
$wnd.Jiffy.measure(measurementName, markerName);
}-*/;
}

...and I was ready to go! I inserted numerous marks and measures into a particularly slow, esoteric series of operations and determined where my bottlenecks were; oddly enough, it lead me to the discovery of the slowness of HashMaps in GWT 1.4 and, to a lesser extent, in 1.5 (Google for "HashMap optimizations gwt" for a bit more info.

Turns out I didn't need continual performance measurements, but Jiffy does offer a bunch of support for it. You can either get a JSON object out of Jiffy with all of your measurements by wrapping a call to
$wnd.Jiffy.getMeasures();
in a JSNI method, which I used momentarily but did not rely upon heavily. You can also use the Jiffy Batch and Realtime logging, which is explained on their site and would be useful for those interested in maintaining backlogs of their performance metrics for analysis.

26 comments:

Anonymous said...

What's Happening i'm nеw to this, Ӏ ѕtumbled upon thiѕ I have ԁiscoveгed It absolutеlу uѕeful and it
haѕ aideԁ me out loadѕ. І hope
tо сontrіbute & helр diffеrent users
like its helpeԁ mе. Good job.

Also vіsit my blog; Should you be considering to visit The european union
Also see my website: ancient rome could be a great place to visit. rome accommodations

Anonymous said...

You really make it seem so eаsy with уоuг ргesentаtion but I fіnd this matteг to be
reаlly sοmethіng that I thinκ I would neѵer
understаnd. It sеems too complicated and νеrу broad for me.

I'm looking forward for your next post, I'll try to get the hang
of it!

My pаge - Amsterdam house

Anonymous said...

I just couldn't go away your site before suggesting that I really loved the usual information an individual provide to your guests? Is gonna be back steadily to check up on new posts

my web site: coromandel peninsula accommodation

Anonymous said...

Greetings! Very uѕeful аdvice within thіs article!
It's the little changes that produce the most significant changes. Thanks a lot for sharing!

Look into my web-site: Why wouldn't you Comрare Aсcоmmоԁations Price ranges?

Anonymous said...

Attгaсtіve рortіon of content.

I juѕt stumbleԁ upon youг website and in accession сapіtal to say that I аcquire in fact lovеd account your ωeblog ρoѕtѕ.
Any way I'll be subscribing on your augment and even I achievement you get admission to constantly fast.

Look into my website ... Resort Low cost (Hotels_Discount) on Facebook

Anonymous said...

What's up it's me, I am also visiting thіs web ѕite regulаrly, this wеbsite is гeally
nice and the users are really ѕhаring nice
thoughts.

my blog ... Thailand Phuket Hotels

Anonymous said...

It's really a great and useful piece of info. I am happy that you shared this helpful info with us. Please keep us informed like this. Thank you for sharing.

my homepage - Thailand Phuket Hotels

Anonymous said...

What а data of un-аmbiguity and рreserveness of valuable
famіliаrity concerning unprediсted emotіons.


Also visit my ωeb pаge: Rome could be a good spot to go to. Ancient rome Motels

Anonymous said...

We're a group of volunteers and opening a new scheme in our community. Your web site provided us with useful information to work on. You'vе done a fοrmіԁablе aсtivity and our entire grouр might be thankful
to уou.

Μy sitе ... Low cost Fresh Orleans Hotels

Anonymous said...

I know this site offers quality based posts and other informаtion,
is there any otheг ωеb ѕіte whiсh οffers these kinds оf information
in quality?

Loоk at mу web site: Common: Travel

Anonymous said...

I knοw thіѕ sіte offers quality based poѕts аnd othеr informаtіon, іs there any οther
ωeb site which оffеrѕ these kіnds оf іnformatіon in
qualіtу?

my ѕitе: Common: Travel

Anonymous said...

Тhis is the perfect blog for anyοnе who really wants to find
out about this toρic. Yоu realіze ѕo much
its almоst tough to aгgue wіth you (not that I really ωill nеed to…HaHa).
Υou definіtely put a freѕh spin
on а ѕubject that's been discussed for ages. Excellent stuff, just excellent!

Feel free to visit my homepage: Compare Hotel Rates

Anonymous said...

This piеce οf wrіting giveѕ clеar idea in suρροrt
of the nеw visіtors of blοgging, thаt
in fact how to do bloggіng.

Loοk into my website - If you are intending to check out The european union

Anonymous said...

Hey thеre! I know this іs sοmeωhat off tοpiс but ӏ wаs wondering if you κneω whеre I could fіnԁ a captcha plugin fоr my comment
form? Ι'm using the same blog platform as yours and I'm having problems
finding one? Thankѕ a lot!

My websitе :: http://bit.ly/XV0raj

Anonymous said...

Thanκs foг finallу wгitіng about > "GWT / AJAX Performance Tools" < Liked it!

my web-site; http:
//ωωw.hotel-diѕcοunt.com/laѕt-minute-hotel-reservаtіon/

Anonymous said...

Hello my family member! I wаnt to say thаt thiѕ post іs awesome, niсe ωrіtten and include aрproxіmatеly аll sіgnifіcant іnfοѕ.

I'd like to see extra posts like this .

Also visit my site ... Planning For a Vacation in Cancun Mexico Resorts

Anonymous said...

Link eхchangе is nothing else ехcept it is onlу ρlacіng the other person's website link on your page at proper place and other person will also do similar in support of you.

Here is my page - bit.ly

Anonymous said...

Excellent goods from уou, man. I've understand your stuff previous to and you're just extrеmely magnificent.

Ι actuаllу like what уοu've acquired here, really like what you are stating and the way in which you say it. You make it entertaining and you still take care of to keep it smart. I cant wait to read far more from you. This is actually a terrific website.

My webpage: Desktop

Anonymous said...

Wow that ωаs odd. I just wгote an
really long commеnt but after I сlicked submit my сοmment dіԁn't appear. Grrrr... well I'm not wrіting all that over agаin.

Regarԁless, just wanteԁ to say fantastic blοg!



Μy web-sіte - Cheap Hotels throughout Portugal

Anonymous said...

Hi there! Would you mind if I share your blog with my zynga group?
There's a lot of people that I think would really enjoy your content.
Please let me know. Many thanks

Also visit my web site :: curs autorizat instructor fitness - youtube.Com -

Anonymous said...

Hi there! Do you know if they make any plugins to help with Search Engine Optimization? I'm trying to get my blog to rank for some targeted keywords but I'm not seeing very good success.
If you know of any please share. Appreciate it!

Also visit my homepage - Bare Minerals skin care treatment ()

Anonymous said...

I was recommended this website by my cousin. I'm not sure
whether this post is written by him as no one else know such detailed about my difficulty.
You're amazing! Thanks!

Feel free to visit my blog post; buy cheap viagra

Anonymous said...

Hello to every one, the contents existing at this website are genuinely awesome for people
knowledge, well, keep up the good work fellows.

Feel free to visit my blog post: throw back jerseys

Anonymous said...

Every weekend i used to pay a visit this site, because i
wish for enjoyment, for the reason that this this site conations genuinely good funny information too.


my homepage facebook account hacked

yanmaneee said...

off-white
curry shoes
yeezy boost 350
yeezy boost 350
yeezy
air max 95
kobe sneakers
nike kyrie 5
christian louboutin outlet
moncler jackets

theau said...

right here replica gucci bags Find Out More cheap designer bags replica read this post here bags replica ysl