Re: Compiler String Efficiency
- From: "Jonathan Wood" <jwood@xxxxxxxxxxxxxxxx>
- Date: Thu, 15 Sep 2005 15:02:56 -0600
Although not all this information is available, I would consider 1 and 2
equal (1 creates a String before passing it as an argument).
3 must create two different strings. I see no reason for this.
Note: If the argument is by reference, then the address of the string is
passed. This is quite a bit more efficient that ByRef string arguments,
which cause VB to create a second string and pass the address of that.
--
Jonathan Wood
SoftCircuits
http://www.softcircuits.com
Available for consulting: http://www.softcircuits.com/jwood/resume.htm
<dw85745@xxxxxxxxxxxxx> wrote in message
news:1126816987.411846.61400@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> What is most efficient and what is the difference in the amount of
> string memory allocated (in the calling routine) between:
>
> 1) Passing a string directly to a function where the function requires
> a string parameter?
>
> e.g. OpenRecordSet("tblMyStuff")
>
> 2) Just allocating a VB String
>
> e.g. Dim strTableName As String
> strTableName = "tblMyStuff"
> OpenRecordSet(strTableName)
>
> 3 Allocating the exact string size
>
> e.g. Dim strTableName As String
> strTableName = Space$(10)
> strTableName = "tblMyStuff"
> OpenRecordSet(strTableName)
>
> Thanks
> David
>
.
- Follow-Ups:
- Re: Compiler String Efficiency
- From: dw85745@xxxxxxxxxxxxx
- Re: Compiler String Efficiency
- From: dw85745@xxxxxxxxxxxxx
- Re: Compiler String Efficiency
- References:
- Compiler String Efficiency
- From: dw85745@xxxxxxxxxxxxx
- Compiler String Efficiency
- Prev by Date: Compiler String Efficiency
- Next by Date: How to get list of associated programs?
- Previous by thread: Compiler String Efficiency
- Next by thread: Re: Compiler String Efficiency
- Index(es):
Relevant Pages
|