- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I was just curious - in F90, and in particular, for CVF, if I have a routine that accesses a derived-type variable many times during the course of a simulation, is it any more advantageous to store that derived type variable as a local variable as opposed to just using it directly. In other words, is it significantly faster to access a variable ala
var1 = data%var1
DO i = 1, 10000
var2 = var1
ENDDO
or would it make no difference in terms of execution speed to just do
DO i = 1, 10000
var2 = data%var1
ENDDO
If not, would it also hold true for multiply embedded derived types, ala
var2 = data%var1(1)%var3%var4
Chris
I was just curious - in F90, and in particular, for CVF, if I have a routine that accesses a derived-type variable many times during the course of a simulation, is it any more advantageous to store that derived type variable as a local variable as opposed to just using it directly. In other words, is it significantly faster to access a variable ala
var1 = data%var1
DO i = 1, 10000
var2 = var1
ENDDO
or would it make no difference in terms of execution speed to just do
DO i = 1, 10000
var2 = data%var1
ENDDO
If not, would it also hold true for multiply embedded derived types, ala
var2 = data%var1(1)%var3%var4
Chris
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In current versions of CVF, it should make no difference. My general recommendation is to write code in a way that makes sense to you, and not spend time worrying up front about which programming paradigm is "fastest". (You should try to be aware of significant performance divots, such as vector subscripts.)
Steve
Steve

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page