Thursday, January 2, 2014

Profiling GWT applications with v8 and d8

The v8 JavaScript engine has a command line version called d8 that can be used as a profiler.
It can help you spot performance problems with your JavaScript in many different ways. If you want to get a good overview of how to profile JavaScript, here is a Google I/O talk on the subject: "Breaking the JavaScript speed limit with v8".
Unfortunately the d8 profiler was not very useful for GWT applications (or any application that was compiled to JavaScript) in the past, since it highlighted problems in JavaScript with line numbers, which does not make a whole lot of sense for a GWT application. Compiling in pretty mode was no option either, since different code layout will lead to different optimizations in v8 (Currently v8 backs our of optimizing a function if it is too large, also counting comments). And of course you want to profile the same code that will be run by your users.

This is why we added source maps support to the v8 profiling tools. Using a special GWT linker you can now profile your GWT application in d8 and get back Java line numbers. This is one of the things that we did to help the our colleagues to make Google Sheets as fast as possible.

Here is how you can profile your GWT application:

Build v8 locally

Build your version of v8 using these instructions. After that make sure that d8 (most likely under out/native) and the tickprocessor (tools/mac-tick-processor or tools/linux-tick-processor or tools/windows-tick-processor.bat)  are available in your path.

Create an entrypoint that runs your performance critical code

Create a new GWT module with an EntryPoint that calls your performance critical code. In your gwt.xml file you need to add the linker, set the user agent and enable source maps:

<define-linker name="d8" class="com.google.gwt.core.linker.D8ScriptLinker"/>
<add-linker name="d8" />
<set-property name="user.agent" value="safari" />
<set-property name="compiler.useSourceMaps" value="true"/>

Compile your GWT app

Now you can just invoke the GWT compiler for your module. It will produce three files that you should move into one directory for your profile:
  • selection script: .nocache.js
  • actual program: .js
  • sourcemap: (located in WEB-INF/deploy//symbolmaps/_sourceMap0.json)

Run the profiler

This blog post does not cover all the details on how to use d8, this is much better covered by the v8 team, but most of the times for a GWT app you want to run:

d8 -prof <modulename>.js

(You want to make sure that all files are in the same directory and that you are running d8 from that directory)
This will create a file called v8.log that contains all the information from that profile run. Now we will use the tick processor to analyze this file, but we also need to pass it the source map, so that it can give us Java line numbers:

linux-tick-processor --sourceMap=<path to sourcemap> v8.log

This will output a complete profile of your JavaScript. It will show you how much time you spend executing JavaScript (and which functions / Java methods), executing C++ or in library code. It also contains a drill down view of your profile.

Sum up

With the changes we made to v8 and GWT you can now use the great v8 toolchain to spot performance problems in your GWT applications. These tools will also allow us to improve the way the GWT compiler translates code in order to make it run faster as well as improving the standard libraries that come with GWT.  You can look forward to your GWT applications running faster in the future.

49 comments:

  1. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. Great Article android based projects

      Java Training in Chennai

      Project Center in Chennai

      Java Training in Chennai

      projects for cse

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. I like d8 application because it is useful for profiler. Currently i am working on event planning app for ipad and d8 is very helpful in my working activities.

    ReplyDelete
  3. The primary objective of implementing SEO to a company's website is to drive targeted traffic to it. Eye tracking studies have shown that searchers scan a search result from top to bottom and left to right, looking for relevant results.Blog Comment

    ReplyDelete
  4. Profile Picture is the new term introduced by Facebook Romantic Whatsapp DP download of the year. Whatsapp DP Images download: We have collected the most recent DP and profile pic

    ReplyDelete
  5. I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. Thank you a lot! and if you need App development company then contact us!

    ReplyDelete
  6. I'm glad that there are people who still care more about cultural development and education.

    tutu app
    tutuapp
    tutuapp download

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. SEO is so important. In short, SEO is significant because it makes your website more visible, and that means more traffic and more opportunities to convert prospects into customers. I work for a software house Karachi and will definitely share this post to my colleagues.

    ReplyDelete
  9. Great post I would like to thank you for the efforts you have made in writing this interesting and knowledgeable article. web design company

    ReplyDelete
  10. ketika pria sudah tidak bisa lagi memberi kepuasan maka yang dikhawatirkan wanita akan merasakan kebosanan jika kejadian seperti itu tidak segera diatasi, oleh karena itu levitra asli 100 mg cod bandung bisa menjadi solusi pasutri yang ingin mencapai kepuasan dalam bercinta. viagra asli adalah tablet mungil yang berasal dari bayer sangat bermanfaat bagi pria yang ingin memperbaiki ereksi agar bisa mencapai klimaks. wanita butuh hubungan yang lama agar libidonya bisa terangsang sampai puncak klimaks. procomil spray sangat cocok untuk mengatasi ejakulasi dini pria ketika sedang berhubungan badan. vitamale adalah obat kuat bpom yang dibuat diindonesia berguna untuk memelihara stamina pria agar tetap kuat saat diranjang klik web . banyak pria yang mencari vimax spray untuk memuaskan pasangan mereka supaya tidak cepat keluar sperma waktu sedang berhubungan.

    ReplyDelete
  11. Write more, that’s all I have to say.
    Literally, it seems as though you relied on the video to make your point.
    Thanks for sharinhg!
    Keep it up!
    blue-iris-5-3-crack/

    ReplyDelete
  12. The company that provides the best bathroom remodeling near me is Fairbanks Builders.

    ReplyDelete
  13. I recently found many useful information in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing.
    how much does metal roofing cost

    ReplyDelete
  14. It is imperative that we read blog post very carefully. I am already done it and find that this post is really amazing.
    wedding videography prices

    ReplyDelete
  15. Thanks you very much for sharing these links. Will definitely check this out..
    content creation

    ReplyDelete
  16. This comment has been removed by the author.

    ReplyDelete
  17. You have a good point here!I totally agree with what you have said!!Thanks for sharing your views...hope more people will read this article!!!
    md landscaping

    ReplyDelete
  18. I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.
    the kind of apartment you want

    ReplyDelete
  19. Practitioners are coming up with technology to reduce the side effects that is well revised by the manufacturers to produce a well-organized mandibular advancement device which fuels the growth of mandibular advancement devices market globally.

    Also read: acetic anhydride market | Medical Devices Market

    ReplyDelete
  20. Great post, and great website. Thanks for the information!
    moe's pizza near me

    ReplyDelete
  21. That appears to be excellent however i am still not too sure that I like it. At any rate will look far more into it and decide personally!
    professional article writing service

    ReplyDelete
  22. Excellent article. Very interesting to read. I really love to read such a nice article. Thanks! keep rocking.
    hair salon raleigh nc

    ReplyDelete
  23. Thank you so much for sharing this great blog.Very inspiring and helpful too.Hope you continue to share more of your ideas.I will definitely love to read.
    script writers for hire

    ReplyDelete
  24. Thanks for the post and great tips..even I also think that hard work is the most important aspect of getting success..
    moss hawg

    ReplyDelete
  25. Your website is really cool and this is a great inspiring article. Thank you so much.
    email copywriting services

    ReplyDelete
  26. Thanks for the post and great tips..even I also think that hard work is the most important aspect of getting success..
    Davis County homes for sale

    ReplyDelete
  27. It was wondering if I could use this write-up on my other website, I will link it back to your website though.Great Thanks.
    coleman fast pitch tents

    ReplyDelete
  28. Read Ample Advice From Successful Multi-level Marketing Experts

    People need extra money today. Having more than one form of income helps balance the budget. There are so many people who are actually earning extra income with the help of multi-level marketing. You can reap the benefits of these companies if you have the right information. Continue reading for some crucial information about profiting in MLM.

    If you have a multi-level marketing business with a focus on product parties, make sure to book a minimum of three parties at every event. Before walking away from each event, try to schedule at least three more parties. Doing this will ensure that your business grows rather than just sustain itself.Tools for BI analysts

    Work hard each day. You need to climb higher and raise your goals. Your business should make some small progress every day. This doesn't necessarily have to be a huge advancement. Just a little bit of sharing on social networks could be enough.

    Teach yourself multiple methods of marketing. To succeed at multi-level marketing, you need to become a student of a lot of different marketing tactics and styles. It's important to know how to market as much face to face as it is behind a computer. You'll use all these skills.

    Listen to your customers and solve their problems with your products. That's the key to selling in a heart beat. It starts with knowing your product like the back of your hand and listening to your customers with a keen ear. You'll soon discover ways your product can really help them.

    Learn the realities of MLM. You may have seen some marketers may sell products claiming that you can earn a lot of income quickly. Be careful of scams like this. Like other endeavors, you may not earn anything in MLM. However, hard work, a solid marketing strategy, and great marketing skills can help you see success.

    In order to succeed in multi-level marketing, you must be willing to listen to your mentors and learn. Most multi-level marketing companies offer mentorship from the company's MLM veterans to new representatives. It is in the veteran's best interest to see you succeed, so most of the time they are willing to teach you how the system works. You can duplicate your mentor's success by listening and practicing what they teach.

    Now you are equipped with the knowledge you need to achieve success in MLM. Put these ideas into play, and let the money roll in. Eventually you may have an income stream that can really help you when you need to get your bills paid.

    ReplyDelete
  29. What a fantabulous post this has been. Never seen this kind of useful post. I am grateful to you and expect more number of posts like these. Thank you very much.
    250 watt solar panel

    ReplyDelete
  30. Folder Guard Crack is software designed to protect and hide your personal files from other users and keep your important data safe from prying eyes.
    Antares Autotune Pro Crack Mac
    Neat Video Crack
    Advanced Systemcare Pro Crack Serial Key

    ReplyDelete
  31. Omnisphere Crack is arguably one of the most powerful and amazing software programs available on the market and can be downloaded completely free of charge in the iso documentation.
    Filmora Crack
    Hex Editor Neo 6 Crack Keygen
    Rhino 6 Crack

    ReplyDelete
  32. Thanks For sharing this Superb article.I use this Article to show my assignment in college.it is useful For me Great Work.
    cavalleria toscana australia

    ReplyDelete
  33. You know your projects stand out of the herd. There is something special about them. It seems to me all of them are really brilliant!
    mop definition

    ReplyDelete
  34. The information you have posted is very useful. The sites you have referred was good. Thanks for sharing...
    Delta 8 THC winston Salem

    ReplyDelete
  35. Love what you're doing here guys, keep it up!..
    salem dispensary

    ReplyDelete
  36. Hey what a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this. Thank you very much and will look for more postings from you.
    https://voyance-tel-avenir.com/

    ReplyDelete
  37. I really thank you for the valuable info on this great subject and look forward to more great posts. Thanks a lot for enjoying this beauty article with me. I am appreciating it very much! Looking forward to another great article. Good luck to the author! All the best!
    kitchen remodeling companies

    ReplyDelete
  38. What a fantabulous post this has been. Never seen this kind of useful post. I am grateful to you and expect more number of posts like these. Thank you very much.
    moe's doughs

    ReplyDelete
  39. Your website is really cool and this is a great inspiring article.
    casket

    ReplyDelete
  40. Hi, I find reading this article a joy. It is extremely helpful and interesting and very much looking forward to reading more of your work..
    bathroom remodeling contractors

    ReplyDelete
  41. Wow i can say that this is another great article as expected of this blog.Bookmarked this site..
    importance of team alignment

    ReplyDelete
  42. I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business.
    kitchen and bath remodeling

    ReplyDelete
  43. Nice to read your article! I am looking forward to sharing your adventures and experiences.
    Arenal Volcano Chocolate Tour

    ReplyDelete
  44. What a fantabulous post this has been. Never seen this kind of useful post. I am grateful to you and expect more number of posts like these. Thank you very much.
    cbd cigarettes

    ReplyDelete