- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
I have a linked list class:
Type :: LLEle !!the list element Integer :: Isval Type(LLEle_IS), Pointer :: next=>null() End type LLEle Type :: LLCon !!the list container Integer, Pointer :: ISOutPutUnit=>null() Integer :: ISLength=0 Integer :: issubstat=0 Character(:), allocatable :: CSMSG Type(LLEle), Pointer :: TLStart=>null(), TLEnd=>null(),& & TLRun=>null(), TLTmp=>null(), TLLastAdded=>null() contains Procedure, Pass :: Add => SubAddToList Procedure, Pass :: Insert => SubInsert ....................... End Type LLCon_Is
I noticed that changing "isval" to "allocatable" doubles the processing time (which is sort of reasonable), but also doubles the ram requirement of the list. Note that allocation of isval is done implicitly ("isval=input", not "Allocate(isval,source=input)").
I can imagine that without the allocatable keyword, the scalar is accessible through the memory address of the allocated list element, whereas with the allocatable keyword, the scalar will have an own memory address, in addition to the memory address of the pointer. this then will inturn have consequences for the access speed when searching for values because two addresses must be resolved. However, I am just guessing, so someone with a more profound understanding of the matter may clarify.
Any suggestions are much appreciated.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Only doubles? I would expect more. As an integer, IsVal takes 4 bytes per list element. As allocatable, each list element contains the descriptor for the allocatable value, which is many more, plus the allocated storage itself.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page