Compiler String Efficiency
Tech-Archive recommends: Speed Up your PC by fixing your registry
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
.
Relevant Pages
- Re: design question
... >>to save a deep copy, when I don't need it. ... I use a plus or minus system: when allocating I always allocate the amount I ... length of the string varies from the buffer size by a certain threshold. ... char array to the char array member of the string class, ... (comp.lang.cpp) - Re: malloc vs new for POD types
... I'm allocating the memory by ... > I'm calling the constructor by myself, and I'm calling the destructor by ... special string, and then working with the string. ... > Ofcourse, in the above, the dynamic memory allocation is unnecessary. ... (comp.lang.cpp) - Re: Fastest way to read characters
... >> copied to a volatile string. ... the string should go with it. ... >> As it is, you're allocating twice ... This trades a byte array mem allocation for an implicit StrConv, ... (microsoft.public.vb.general.discussion) - Re: Why this code works fine under C6.0, but failed under .NET compiler?
... I was quite confused by this too, so I tried it, and indeed it seems to compile and superficially work, except of course that as expected the buffer is actually a read-only string and accvio's if you try to modify it. ... It appears that what it's doing is assigning the pointer to the constant string into the temporary variable of type char* that new returns, and then of course assigning the result of that "=" operator into the declared char* variable. ... with the side effect of allocating some memory and throwing away the pointer. ... read-only memory, then any attempt to modify it will cause an exeption. ... (microsoft.public.development.device.drivers) - Re: PInvoked strings seem to be different from what is sent
... the "GetTag" call is a simple one as well ... ... allocating results")); ... >> Public Shared Function DbGetSessionID(ByVal psXML As String, ... >> psSessionID As String) As Boolean ... (microsoft.public.dotnet.framework.compactframework) |
|