473,738 Members | 7,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

while loops within while loops causing huge memory problem

hi all

i have a script that retrieves rows from a single table, rows are
related to eachother and are retrieved by doing a series of while loops
within while loops. bcos each row contains a text field they are fairly
large. the net result is that when 60 or so results are reitreved the
page size is 400kb! which takes too long to load. is there a way of
shorterning this? freeing up the memory say, bcos what is actually
displayed is not that much, its just the use of multiple loops (about
10) that does it i think

Oct 18 '06 #1
3 2421

monomaniac21 wrote:
hi all

i have a script that retrieves rows from a single table, rows are
related to eachother and are retrieved by doing a series of while loops
within while loops. bcos each row contains a text field they are fairly
large. the net result is that when 60 or so results are reitreved the
page size is 400kb! which takes too long to load. is there a way of
shorterning this? freeing up the memory say, bcos what is actually
displayed is not that much, its just the use of multiple loops (about
10) that does it i think
If the page size delivered to the browser is 400kb, then it's 400kb's
worth of data. You can't change that by freeing up memory in PHP.

If the page is getting too large, then consider using pagination to
break up all that data into smaller sets across multiple pages. For
instance, limit each page to only show 100 records and provide
Previous/Next links to navigate across all the results.

Moot

Oct 18 '06 #2
"monomaniac 21" <mc******@googl email.comwrote in message
news:11******** **************@ e3g2000cwe.goog legroups.com...
hi all

i have a script that retrieves rows from a single table, rows are
related to eachother and are retrieved by doing a series of while loops
within while loops. bcos each row contains a text field they are fairly
large. the net result is that when 60 or so results are reitreved the
page size is 400kb! which takes too long to load. is there a way of
shorterning this? freeing up the memory say, bcos what is actually
displayed is not that much, its just the use of multiple loops (about
10) that does it i think

Clearly the code needs to be optimized. Depending how bad the design is, you
should start looking at the query string, maybe the database structure. Now
it just doesn't sound too smart if it takes ten nested while loops to pull
out some simple data... But without seeing the actual code it's very
difficult to say anything more specific.

--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
sp**@outolempi. net | rot13(xv***@bhg byrzcv.arg)
Oct 19 '06 #3
Rik
Kimmo Laine wrote:
"monomaniac 21" <mc******@googl email.comwrote in message
news:11******** **************@ e3g2000cwe.goog legroups.com...
>hi all

i have a script that retrieves rows from a single table, rows are
related to eachother and are retrieved by doing a series of while
loops within while loops. bcos each row contains a text field they
are fairly large. the net result is that when 60 or so results are
reitreved the page size is 400kb! which takes too long to load. is
there a way of shorterning this? freeing up the memory say, bcos
what is actually displayed is not that much, its just the use of
multiple loops (about 10) that does it i think


Clearly the code needs to be optimized. Depending how bad the design
is, you should start looking at the query string, maybe the database
structure. Now it just doesn't sound too smart if it takes ten nested
while loops to pull out some simple data... But without seeing the
actual code it's very difficult to say anything more specific.
A self-referential table of a adjacency model often takes either a lot of
while loops or a lot of joins. It might be usefull to switch to a nested
model in that case.

http://dev.mysql.com/tech-resources/...ical-data.html

Neither explains a 400KB HTML page offcourse, if the actual data is small,
something else is definately wrong.

Grtz,
--
Rik Wasmus
Oct 19 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
2711
by: Andrew Koenig | last post by:
PEP 315 suggests that a statement such as do: x = foo() while x != 0: bar(x) be equivalent to while True:
34
4172
by: Adam Hartshorne | last post by:
Hi All, I have the following problem, and I would be extremely grateful if somebody would be kind enough to suggest an efficient solution to it. I create an instance of a Class A, and "push_back" a copy of this into a vector V. This is repeated many times in an iterative process. Ok whenever I "push_back" a copy of Class A, I also want to assign a pointer contained in an exisiting instance of a Class B to this
3
9478
by: RobG | last post by:
A little while ago I opined that do/while loops are harder to read than for loops, and therefore I preferred using for loops. However, it was pointed out that do/while has significant performance benefits as evidenced by: <URL:http://www.websiteoptimization.com/speed/10/10-2.html> (There's a bug in the page, testLoop is both a function name and the name of the form but if you download the page & rename
6
4545
by: Jain, Pranay Kumar | last post by:
Hi All, We have created a simple application that takes a dataset and generates the data in Excel schema format. It uses an xslt file to do the transformation for excel 2002 and so on. We are using the dotnet.xml resource and not the MSXML 4. The application is golden and works fine with realtively Medium size of data(around 25MB). We started to see issues if the data is greater then 25 MB where the transformation takes tooo long and...
2
2954
by: VM | last post by:
When I display data to a Windows datagrid I usually fill the underlying table (in another class) and then, once it contains all the data, I attach it to the grid. But there are some processes that involve large amounts of data so the user won't be able to see anything in the grid until after the table's already filled up (usually 40-60 secs with these large processes). Is it possible (without changing the process of filling the table...
6
3803
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory†exception. To get an idea what happens I traced some values using performance monitor and got the following values (for one day): \\FFDS24\ASP.NET Applications(_LM_W3SVC_1_Root_ATV2004)\Errors During Execution: 7 \\FFDS24\ASP.NET Apps v1.1.4322(_LM_W3SVC_1_Root_ATV2004)\Compilations
9
2077
by: liljencrantz | last post by:
Hi, I have a piece of code that uses hashtables to store pointers to various bits of data. The hashtable sees all pointers as const void *, while the application obviously uses various other pointer types for the data. I've run into a warning with the following code: void hash_remove( hash_table_t *h, const void *key, const void **old_key,
9
3504
by: none | last post by:
Hi all, First, let me preface this by the fact that I'm completely new to the language, but not to programming in general. I'm trying to get my feet wet with something near and dear to my heart: database programming. Here's what I've got: import pgdb;
5
1814
by: ertis6 | last post by:
Hi all, I need to calculate a value inside 8 nested for loops. 2 additional for loops are used during calculation. It was working fine with 4 loops. My code is like this: ... for(int i1=0; i1<x1; i1 = i1++){ ... for(int i2=0; i2<x2; i2 = i2++){
0
8788
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9335
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9263
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6751
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.