File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Performance and the fly likes Converting an ArrayList to Json Object Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Performance
Reply Bookmark "Converting an ArrayList to Json Object" Watch "Converting an ArrayList to Json Object" New topic
Author

Converting an ArrayList to Json Object

sangram nani
Greenhorn

Joined: Nov 27, 2011
Posts: 11
My project is a struts2 webapplication with Hibernate3. The application response time is slow in few Actions, like viewing the complete list of member in a organization. Am a using an Arraylist to retrieve the list of members from a organization Table. If there are <10 records in a organization then the response page is fast, but if it exceeds more than 10 then the response is slow. Currently, we are just retrieving the list from Arraylist and then displaying results in JSP. Please suggest me, does converting the ArrayList to JSON object, and then using the JSON object results to display data in JSP's works faster or should i look for other alternative.
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 2771

You should identify where the bottleneck is. Does the problem lie with generating the JSON, or retrieving the data or something else still? Write a couple of tests to figure out what part of the program you're not satisfied with.
Jayesh A Lalwani
Ranch Hand

Joined: Jan 17, 2008
Posts: 301

Generally, it;s not a good idea to retreive a lot of objects from the DB and send it over to the UI. You should have some sort of pagination in the UI that allows the user to see a few entities at a time.

However, the limit of 10 seems too low. You will have to investigate where the bottleneck is. Database queries? Java processing? Network? maybe the javascript that parses and displays the elements is too slow.
 
IntelliJ Java IDE
 
subject: Converting an ArrayList to Json Object
 
Threads others viewed
AJAX Frameworks that integrate with Struts
Improving An Algorithm
Help generating JSON data - I am using FlexJSON lib
Populate Table Rows With Data from AJAX
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture