Fixing JSF state saving: Save vs. Restore
(A bit of esoterica, but probably of interest here to those deeply focused on JSF performance...)
An update: I got a chance to take some timings. As expected, saving state is now much faster: 85-90% faster, roughly equivalent to the improvements in the size of the saved state. But I was very surprised to discover that restoring the view isn't any faster, perhaps even marginally slower - until I realized that was the only possible result.
Restore View has to create a full tree, starting from zero. What could possibly be faster than creating that tree from an object tree that specifies every attribute that needs to be set, every class name that needs to be instantiated? Put another way, the old restoreVIew() approach, for all of its memory inefficiencies, is essentially an equivalent workload to building the tree in the first place, and might be even faster. This new approach starts with the overhead of building the tree from scratch, plus the overhead of setting some additional state. (That additional overhead is fairly negligible, but the point remains: fixing JSF state saving doesn't make Restore View fast.)
A slight clarification, BTW: I'm not using client-side state saving a la the RI or MyFaces, which serializes the entire tree to the client. Instead, we use ADF Faces's tokenized client-side state saving - run
So, does that mean that restoreView() is necessarily slow? Well, no. There are approaches to optimizing restoreView(). The most direct is optimizing building the component tree - which will help both with initial component tree creation and with restoreView(). How to do that in another post. (Hint: FacesBean and Facelets are a huge help here, too!)
An update: I got a chance to take some timings. As expected, saving state is now much faster: 85-90% faster, roughly equivalent to the improvements in the size of the saved state. But I was very surprised to discover that restoring the view isn't any faster, perhaps even marginally slower - until I realized that was the only possible result.
Restore View has to create a full tree, starting from zero. What could possibly be faster than creating that tree from an object tree that specifies every attribute that needs to be set, every class name that needs to be instantiated? Put another way, the old restoreVIew() approach, for all of its memory inefficiencies, is essentially an equivalent workload to building the tree in the first place, and might be even faster. This new approach starts with the overhead of building the tree from scratch, plus the overhead of setting some additional state. (That additional overhead is fairly negligible, but the point remains: fixing JSF state saving doesn't make Restore View fast.)
A slight clarification, BTW: I'm not using client-side state saving a la the RI or MyFaces, which serializes the entire tree to the client. Instead, we use ADF Faces's tokenized client-side state saving - run
saveSerializedView
, but then stash the result on the session, and only send a token to the client. If we were using fully serialized trees, then you would get a performance boost even in Restore View, because you'd only have to unserialize a small block, instead of the whole thing.So, does that mean that restoreView() is necessarily slow? Well, no. There are approaches to optimizing restoreView(). The most direct is optimizing building the component tree - which will help both with initial component tree creation and with restoreView(). How to do that in another post. (Hint: FacesBean and Facelets are a huge help here, too!)
56 Comments:
Hi Adam,
What do you think of this? A lot of times, the structure is static and the values only change. What if the structure was serialized on the first request only? On subsequent requests, the structure was restored but not discarded. Instead, it was cached in request scope. During the last phase, the implementation could call something like UIViewRoot.hasChanged(). If the tree has not changed, skip serialization for the structure entirely and just push the cached version into the response.
By Anonymous, at 10:20 AM
Hi Adam,
Can you please explain a bit more about how the tokenized client-side-state saving in ADF Faces works? E.g, does it require Managed Beans to implement the Serializable interface? And when do these "tokens" expire so that the corresponding session data can be garbage collected?
And finally, will it work together with the saveState tag in MyFaces?
Best Regards,
Bjorn
By Anonymous, at 1:51 PM
Hi Adam,
you wrote:
"So, does that mean that restoreView() is necessarily slow? Well, no. There are approaches to optimizing restoreView(). The most direct is optimizing building the component tree - which will help both with initial component tree creation and with restoreView(). How to do that in another post. (Hint: FacesBean and Facelets are a huge help here, too!)"
I am really needing this kind of optimization for the restoreView phase.
Any suggestions?
By Christian & Svenja, at 8:31 AM
Using midterm paper you can fixed some facts!
By Larah, at 6:52 AM
Good post. Very impressive writing, thanks for sharing.
By cheap android tablet, at 6:24 PM
I Really enjoyed your blog. I just bookmarked it. I am a regular visitor of your website I will share It with my friends .Thanks.
By Online Eye, at 8:46 AM
Thanks for the post. It is very interesting. Buy a midterm paper at an affordable price online.
By order resume, at 9:44 PM
All of high-school and college students can now easily come up with a term paper because of websites like essay writing services . It is one of the best ways to get top-quality essay for a budget price and in a short period of time!
By Unknown, at 12:53 AM
Looking for the best place to buy essay papers? We are waiting for you!
By help with essay writing, at 10:13 PM
Thank you for the good post!
I recommend this essay writing service for all, who want to write so good.
By Professional essay writing service, at 6:05 AM
Hello guys. As for me, writing process is not easy for all the students, especially in that case when students are lack of good writing skills. Thar is why students start to look for the professional writing assistance across the internet, so buy college essays online and with the help of these services they will have more free time.
By Unknown, at 11:25 PM
Hmmm!!! I think that this service is very cool and importent! It should be understood that not all have a good imagination and be able to write well! That is way Thank you for your services that you provide to people who do not have time! They are very cool!! essay writing service !
By TomKorn, at 4:45 AM
Hi! I am Nina. And I want to say, that this article is really entertaining and amusing!It tells us about fixing JSF saving: save vs. restore. It is really helpful information. I will share this information with my friends. And can you recommend me any website for essay writing ? Iw ant to order essay online.
By Unknown, at 5:56 AM
Hello! You know, the most direct is optimizing building the component tree - which will help both with initial component tree creation and with restore. And click here for essay writing service.
By Unknown, at 12:25 AM
Thaty is the truth that there are no approaches to optimizing restoreView. this website will help you to write an article or an essay or any other type of college paper on this topic. Check it out now!
By Unknown, at 5:25 AM
If you are short of time and you have a submission due soon, you cannot adopt the practicing tip as it is time consuming. Nevertheless, you have nothing to worry about. There are some other options that you can explore like hiring someone to make an essay for you. Such kind of services are often available on the Internet. If you need help, then you can always hire professional essay writing services for completing your paper work!
By Unknown, at 10:31 PM
Hello! Are you looking for professional essay writing help? You can get high quality essay writing services from experienced custom college paper writers.
By buy essays online, at 3:57 AM
Hi! I wish you to know, that due to the reading of this post, I learned much useful information! Thanks for sharing!Also, I think it will be helpful for you to visit this online Term Paper writing service, because it is one of the top writing resources offering the best writing help for students!
By Unknown, at 12:33 AM
Oh, as I can see - you are real professional of programming deal. Your site is a real treasure for me. I found here so many useful advices according to my own problems. I like the way you write. I wish you good luck and success to your site!
By editing service, at 5:42 AM
Hi! You are real professional! I want to tell you about the help for all students http://www.essay-mania.com !and you will get the best writing help there!
By Iren, at 11:29 PM
one of the best bloggers I ever saw.Thanks for posting this informative article. Thanks for the post. It is very interesting. funwirks.com
By Hafiz Sajid, at 7:54 AM
Your content is nothing short of brilliant in many ways. I think this is engaging and eye-opening material. burner phone
By Unknown, at 7:32 AM
A bit of esoteric is always good. I like esoteric very much. You write very well, are you professional writer? No? - then you can ask for vacation on papers-writings.com
By Papers-Writings.com, at 1:18 AM
Great informative site. I'm really impressed after reading this blog post. Rio 2016 summer games hotel packages
By Unknown, at 9:08 PM
Great Article
JSF Online Training | JSF Training | JSF Training Courses | Java Training Institutes in Chennai | Java Training in Chennai | Java Course in Chennai | JSF Interview Questions | Java Training Institutes in Chennai | Java Training in Chennai
By for ict 99, at 9:43 PM
I can only imagine how many lessons some youngsters could learn by reading this book. She writes about the modern day problems, we should all take a higher interest in that. This book would be an amazing source of inspiration for me as I am looking for essay writing www.advanced-writer.com. I am glad I found the resource.
By Unknown, at 4:24 AM
thanks a lot of for share a appreciable post ... Sunny Health and Fitness Bike
By Unknown, at 8:24 AM
I was not aware that his new approach starts with the overhead of building the tree from scratch. Thanks for sharing with it though. If you want to check where you can order your custom essays, do not be hesitant about using this online writing company I and my friends trust. Be sure about their high quality!
By Unknown, at 1:56 AM
Like it! Many thanks to your incredible publish! It has been quite beneficial. absent employees
By Unknown, at 9:41 AM
Great Article. Always buying various kinds ideas, I simply bookmarked this page. Ghana Business News
By Unknown, at 12:52 AM
The way of doing something is strongly pointed away and evidently emphasized. welcome mat realty
By Unknown, at 8:57 AM
This content creates a new hope and inspiration with in me. Thanks for sharing article like this. The way you have stated everything above is quite awesome. Keep blogging like this.
JAVA Training in Chennai
By Anonymous, at 2:59 AM
This post is invaluable. How can I find out more? Aimersoft Video Converter Ultimate
IObit StartMenu 8
By hashmi, at 11:45 AM
I Really enjoyed your blog. Now a days essay writing is not esay for student. It's required some technical skill. Our website awriter.org give important information on essay writing.
By sofialery, at 11:04 PM
A-level Literature Review Help. There have increased calls by the Japanese population in Okinawa for the withdrawal of US marines whom they accuse of several criminal activities. If our forces were to withdraw from their largest base overseas, would JSF be able to counter an aggressive China in the Pacific? Would they be able to safeguard Japanese interests? Editing Service Provider
By Curtis, at 9:33 AM
Sering "Anyang-anyangan?" Bisa Jadi Ini Penyebabnya
Anyang-anyangan Sebabkan Infeksi Saluran Kemih
7 Kiat sederhana atasi anyang-anyangan yang mengganggu
Ini Dia Penyebab Anyang Anyangan Bagi Wanita Dan Pria
9 Cara Menyembuhkan Anyang-anyangan Tanpa Ribet
Bahaya Pria Sering Anyang-Anyangan
By Obat Tradisional Miom dan Kista, at 10:56 PM
Very informative and impressive article. You've professionally explained the matter. Keep it up, write more articles and you are welcome if you need any help.
grand-essays writing service
By Heigl, at 3:51 AM
All information which you gave is very useful and attractive I really like that article and enjoyed too.
Download YouTube Playlist Using IDM
By Unknown, at 7:05 PM
All information which you gave is very useful and attractive I really like that article and enjoyed too.
العاب فلاش
العاب طبخ 2017
By al3ab banat01, at 4:42 AM
I was not aware that his new approach starts with the overhead of building the tree from scratch. Thanks for sharing with it though. Avira Antivirus
Camtasia Studio
Wondershare Video Editor
By Activators4Windows, at 4:38 AM
Thank you for such a sweet tutorial - all this time later, I've found it and love the end result. I appreciate the time you spent sharing your skills.
Facebook Lite
By Linda, at 3:04 AM
I am happy to find this post very useful for me
potaup
By alicetaylor, at 12:04 AM
Thank you for such a sweet tutorial - all this time later, I've found it and love the end result. I appreciate the time you spent sharing your skills.
potaca
By Linda, at 12:22 AM
I personally like your post, you have shared good article. It will help me in great deal.
Ludostar.co Skinscraft.online footballgamesbeast.com
By Unknown, at 5:37 PM
Hey there! What a cool post! Thank you for sharing with us. By the way, you can find many helpful tips about writing on this web Essay Master.
By Ciana Langham, at 5:42 AM
Great post! Thanks for sharing! Glad I found it - white paper writing service
By Anonymous, at 7:23 AM
read this above post its very greatful for me thanks sharing this post ,great post.
Best Ice Fishing Gloves Best Ice Fishing Gloves Best Ice Fishing Gloves
By cdcdcdcd, at 12:24 AM
I really enjoyed reading this post. Thanks for sharing!
SaludPulso.com
By Freddi King, at 2:07 PM
hi, it is really a great article.
Recommend an equally great website for everyone, GameMS is undoubtedly the best website to Buy MUT 20 Coins at present, ultra-low price, excellent customer service, fast delivery experience, usually thanks to our rich experience. Most orders can be completed within ten minutes. This is our proud achievement. At the same time, there are other mainstream game currency transactions, providing you with a wealth of options.
By Cadencealida, at 11:48 PM
This comment has been removed by the author.
By Priya Escorts, at 12:03 AM
Thank you for sharing nice blog post. This time social media users finding about Buy Instagram Followers USA under cheap price so here you can go and buy any of social media services to increase brand value.
By Buy Instagram Followers USA, at 12:03 AM
thanks for wonderful content.
keep sharing,
full stack training in bangalore
Dot Net Training Institutes in Bangalore
best angular js training in bangalore
By shakunthala, at 12:16 AM
thanks for sharing this .
Node js training in Bangalore
React js training in Bangalore
By best training institute in bangalore, at 12:17 AM
I love your creativity. Are you also searching for dissertation writing help? we are the best solution for you. We are best known for delivering the best services to students without having to break the bank.
By dissertation writing help, at 3:57 PM
Psychology Assignments are not easy to handle but you can be helped at Psychology Assignment Writing Services And improve your overal grades from the leading Psychology Essay Writing Services provider. The company also offers Nursing Homework Help Online at affordable cost.
By Smart Research USA, at 3:51 AM
It's crucial to abide by the Private Investigators' Code of Conduct while using covert CCTV by private investigators because the practise is contentious. To ensure that people's rights to privacy are not abused, the code offers guidelines on the use of covert CCTV, especially in private residences and on private property. Private investigators must make sure that they have permission from the property's legitimate occupant and that they adhere to all applicable laws and security licence types. Although covert CCTV can be a useful investigative tool, it must be used with the utmost caution and ethics to prevent any legal repercussions.
By Private Investigator UK, at 1:14 AM
Post a Comment
<< Home