I'm running a program that fills relatively large tables using for loops. The tables are at least 50,000 x 4, but can be as large as 200,000 x 4. The tables are taking at least 30 minutes a piece to fill-up. But the whole program, with three large tables, used to run and complete in less than 5 minutes before we switched over to Windows 7 and I upgraded to EViews 64 bit.
My current settings for max threads is auto and I've set EViews as a high priority process. I have also noticed that the CPU usage has been less than 15% throughout (even after setting as a high priority) and memory usage is around 20% as well.
Any thoughts on how I might speed this up?
Slow Population of Tables
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13603
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Slow Population of Tables
We'd need more information on how you've written your loops. Ideally posting the program/workfile.
Re: Slow Population of Tables
Thanks, here is the code to the smallest table:
.........................................................
pivot_output_sh(1,1) = "Year"
pivot_output_sh(1,2) = "Country/Region"
pivot_output_sh(1,3) = "Source"
pivot_output_sh(1,4) = "Concept"
pivot_output_sh(1,5) = "Value"
' Label each table.
!row_counter = 2
for !j = 1980 to 2040
for %y {%ieo_regions}
for %x gi ox hs pr
if %x = "gi" then
for %t {%ieo_go_all_mer}
pivot_output_sh(!row_counter,1) = !j
pivot_output_sh(!row_counter,2) = %y
pivot_output_sh(!row_counter,3) = %x
pivot_output_sh(!row_counter,4) = %t
!value = @elem({%y}_{%t}_sh_{%x},@str(!j))
pivot_output_sh(!row_counter,5) = !value
!row_counter = !row_counter + 1
next
else
if %x = "hs" then
for %t {%ieo_go_old}
pivot_output_sh(!row_counter,1) = !j
pivot_output_sh(!row_counter,2) = %y
pivot_output_sh(!row_counter,3) = %x
pivot_output_sh(!row_counter,4) = %t
!value = @elem({%y}_{%t}_sh_{%x},@str(!j))
pivot_output_sh(!row_counter,5) = !value
!row_counter = !row_counter + 1
next
else
for %t {%ieo_go_all}
pivot_output_sh(!row_counter,1) = !j
pivot_output_sh(!row_counter,2) = %y
pivot_output_sh(!row_counter,3) = %x
pivot_output_sh(!row_counter,4) = %t
!value = @elem({%y}_{%t}_sh_{%x},@str(!j))
pivot_output_sh(!row_counter,5) = !value
!row_counter = !row_counter + 1
next
endif
endif
next
next
next
' Write out in pivot chart (or database) format to table.
.........................................................
pivot_output_sh(1,1) = "Year"
pivot_output_sh(1,2) = "Country/Region"
pivot_output_sh(1,3) = "Source"
pivot_output_sh(1,4) = "Concept"
pivot_output_sh(1,5) = "Value"
' Label each table.
!row_counter = 2
for !j = 1980 to 2040
for %y {%ieo_regions}
for %x gi ox hs pr
if %x = "gi" then
for %t {%ieo_go_all_mer}
pivot_output_sh(!row_counter,1) = !j
pivot_output_sh(!row_counter,2) = %y
pivot_output_sh(!row_counter,3) = %x
pivot_output_sh(!row_counter,4) = %t
!value = @elem({%y}_{%t}_sh_{%x},@str(!j))
pivot_output_sh(!row_counter,5) = !value
!row_counter = !row_counter + 1
next
else
if %x = "hs" then
for %t {%ieo_go_old}
pivot_output_sh(!row_counter,1) = !j
pivot_output_sh(!row_counter,2) = %y
pivot_output_sh(!row_counter,3) = %x
pivot_output_sh(!row_counter,4) = %t
!value = @elem({%y}_{%t}_sh_{%x},@str(!j))
pivot_output_sh(!row_counter,5) = !value
!row_counter = !row_counter + 1
next
else
for %t {%ieo_go_all}
pivot_output_sh(!row_counter,1) = !j
pivot_output_sh(!row_counter,2) = %y
pivot_output_sh(!row_counter,3) = %x
pivot_output_sh(!row_counter,4) = %t
!value = @elem({%y}_{%t}_sh_{%x},@str(!j))
pivot_output_sh(!row_counter,5) = !value
!row_counter = !row_counter + 1
next
endif
endif
next
next
next
' Write out in pivot chart (or database) format to table.
-
EViews Jason
- EViews Developer
- Posts: 870
- Joined: Tue Sep 16, 2008 3:50 pm
Re: Slow Population of Tables
3 things I would try: 1) run the program in quiet mode, 2)presize the table and 3)close the table window if present.
To run in quiet mode by default, select options->general options->runtime settings and select 'Quiet- no screen or status ....'
For #2 and #3, before you populate the table in your program add the following lines
To run in quiet mode by default, select options->general options->runtime settings and select 'Quiet- no screen or status ....'
For #2 and #3, before you populate the table in your program add the following lines
Code: Select all
'if you can precalculate the size of the table then use that value instead of the 200000 I have here
pivot_output_sh(200000,4)= " "
close pivot_output_sh ' close the table windowRe: Slow Population of Tables
Worked like a charm. Thanks very much.
Who is online
Users browsing this forum: No registered users and 1 guest
