Highly Technical Question 
Author Message
 Highly Technical Question

Gurus,

I have a simple question which I am too tied up to investigate at the
moment.

Q)  When using 'dynamic arrays' in VB, does VB intelligently use pointers
under the hood in a fashion similar to a C/C++ linked lists implementation
or does it allocate contiguous space (a potential nightmare when dealing
with an unknown large amount of data at runtime)?  This makes a world of
difference when Redimming a thousand times...

Thanks for the knowledge.

Shawn

PS.  I think that this 'Karl' and 'Damit' should co-develop a website or
something.  It would be a riot!!!



Fri, 30 Mar 2001 03:00:00 GMT  
 Highly Technical Question
I too would be interested in the answer to your array question.

And I too have given up watching soaps on TV after finding the Karl & Gromit
show!

Bertie


Quote:
>Gurus,

>I have a simple question which I am too tied up to investigate at the
>moment.

>Q)  When using 'dynamic arrays' in VB, does VB intelligently use pointers
>under the hood in a fashion similar to a C/C++ linked lists implementation
>or does it allocate contiguous space (a potential nightmare when dealing
>with an unknown large amount of data at runtime)?  This makes a world of
>difference when Redimming a thousand times...

>Thanks for the knowledge.

>Shawn

>PS.  I think that this 'Karl' and 'Damit' should co-develop a website or
>something.  It would be a riot!!!



Sat, 31 Mar 2001 03:00:00 GMT  
 Highly Technical Question
Hi

 The Visual Basic Programmers Journal April 1998 issue had a great article
on how VB manages strings and arrays (see black belt programming article
'Play VB's Strings').

 From what I understood of the article, VB allocates a descriptor (4 bytes)
for each string (and also in a dynamic array) - the actual memory is not
allocated for the string until the first string assignment takes place. The
article showed how to increase VB's string handling speed (sometimes up to a
dozen times faster), by playing around with the descriptors using the VarPtr
and StrPtr VB commands (along with the tried and trusted
RTLMoveMemory/CopyMemory api call).

Hope that helps

Chris Eastwood
Software Engineer
ACNielsen Ltd

Quote:

>I too would be interested in the answer to your array question.

>And I too have given up watching soaps on TV after finding the Karl &
Gromit
>show!

>Bertie



>>Gurus,

>>I have a simple question which I am too tied up to investigate at the
>>moment.

>>Q)  When using 'dynamic arrays' in VB, does VB intelligently use pointers
>>under the hood in a fashion similar to a C/C++ linked lists implementation
>>or does it allocate contiguous space (a potential nightmare when dealing
>>with an unknown large amount of data at runtime)?  This makes a world of
>>difference when Redimming a thousand times...

>>Thanks for the knowledge.

>>Shawn

>>PS.  I think that this 'Karl' and 'Damit' should co-develop a website or
>>something.  It would be a riot!!!



Sat, 31 Mar 2001 03:00:00 GMT  
 Highly Technical Question
Chris,

Indeed, I found your suggestion very informative and generally helpful.
However, I am asking about the implementation of dynamic array storage, not
about the storage of strings (either in arrays or not).  Also, I'm not
necessarily always using dynamic arrays for strings.  Many times, I am
holding pointers to objects, complex nested user types, etc...

So again I ask,

"When using 'dynamic arrays' in VB, does VB intelligently use pointers
under the hood in a fashion similar to a C/C++ linked lists implementation
or does it allocate contiguous space (a potential nightmare when dealing
with an unknown large amount of data at runtime)?  This makes a world of
difference when Redimming a thousand times..."

Thanks for any help,

Shawn Woods



Sat, 31 Mar 2001 03:00:00 GMT  
 Highly Technical Question
You should be able to determine this using the Varptr function for the first
element of the array before and after the redim (preserve ??). My
recollection is that VB maintains contiguous arrays and that REDIM is very
inefficient. The article mentioned in the previous post covers both arrays
and strings. (I also recall a similar article on collections which showed
that you could write a collections class in VB which is more efficient than
using native VB collections! )

/Ian

http://storrs.home.ml.org


Quote:
>Chris,

>Indeed, I found your suggestion very informative and generally helpful.
>However, I am asking about the implementation of dynamic array storage, not
>about the storage of strings (either in arrays or not).  Also, I'm not
>necessarily always using dynamic arrays for strings.  Many times, I am
>holding pointers to objects, complex nested user types, etc...

>So again I ask,

>"When using 'dynamic arrays' in VB, does VB intelligently use pointers
>under the hood in a fashion similar to a C/C++ linked lists implementation
>or does it allocate contiguous space (a potential nightmare when dealing
>with an unknown large amount of data at runtime)?  This makes a world of
>difference when Redimming a thousand times..."

>Thanks for any help,

>Shawn Woods



Sat, 31 Mar 2001 03:00:00 GMT  
 Highly Technical Question
hi!
i think i've met the same problem when i programed on Ownerdraw Menus using
vb5.
i used VarPtr function and MoveMemory API to transfer an userdefined type to
an address and retrieved it.

hope help.



Quote:
>Chris,

>Indeed, I found your suggestion very informative and generally helpful.
>However, I am asking about the implementation of dynamic array storage, not
>about the storage of strings (either in arrays or not).  Also, I'm not
>necessarily always using dynamic arrays for strings.  Many times, I am
>holding pointers to objects, complex nested user types, etc...

>So again I ask,

>"When using 'dynamic arrays' in VB, does VB intelligently use pointers
>under the hood in a fashion similar to a C/C++ linked lists implementation
>or does it allocate contiguous space (a potential nightmare when dealing
>with an unknown large amount of data at runtime)?  This makes a world of
>difference when Redimming a thousand times..."

>Thanks for any help,

>Shawn Woods



Fri, 13 Apr 2001 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Highly Technical Question

2. Highly Technical Question

3. Require Highly technical information on ADOCE , When is data actually stored

4. Advanced technical analysis of stock indexes for the technical programmers who invest - djia.gif (1/1)

5. Advanced technical analysis of stock indexes for the technical programmers who invest - djia.gif (0/1)

6. Cyclical analysis of the stock market for the highly technical programmer who also plays the markets - indud.gif (0/1)

7. Cyclical analysis of financial markets for the highly technical programmer who plays the markets - indud.gif (1/1)

8. Cyclical analysis of financial markets for the highly technical programmer who plays the markets - indud.gif (0/1)

9. Cyclical analysis of the stock market for the highly technical programmer who also plays the markets - indud.gif (0/1)

10. Technical question.

11. Stock Technical Analysis Question

12. Looking for a set of question to do VB technical inteview

 

 
Powered by phpBB® Forum Software