473,394 Members | 2,100 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Any performance issues using CallByName?

I use a generic Processing form (modal) where I pass it an object and method
name and parameters if needed and then use CallbyName to execute the passed
in method. What this does for me is lock out user input on the parent form
as the Processing form has no input controls until all processing is
complete.

I was curious if CallByName is a good way to perform this operation?
Nov 21 '05 #1
8 6352

It would be better if all the objects passed in implemented the same
interface and the modal form called a known method. Any params can be
stored within the object instance ahead of time or passed as a generic
object array.

Another way to handle this is to use delegates.. pass a delegate to
the form allong with an object array of params, and the form can
invoke the delegate. This would work fine but in my opinion the
interface method is a cleaner implementation.

CallByName uses late binding and reflection internally and has a lot
of overhead that isn't necessary for the task.

HTH,

Sam
On Fri, 7 Jan 2005 10:13:02 -0800, "Rob R. Ainscough"
<ro*****@pacbell.net> wrote:
I use a generic Processing form (modal) where I pass it an object and method
name and parameters if needed and then use CallbyName to execute the passed
in method. What this does for me is lock out user input on the parent form
as the Processing form has no input controls until all processing is
complete.

I was curious if CallByName is a good way to perform this operation?


Nov 21 '05 #2
Unfortunately the purpose of the Processing form is to be generic in nature
so the methods and objects are not known ahead of time. The CallByName is
only used once (not used in a loop).

Do you have any specific numbers to indicate the overhead of CallByName vs.
another approach?

Thanks, Rob.

"Samuel R. Neff" <bl****@newsgroup.nospam> wrote in message
news:l9********************************@4ax.com...

It would be better if all the objects passed in implemented the same
interface and the modal form called a known method. Any params can be
stored within the object instance ahead of time or passed as a generic
object array.

Another way to handle this is to use delegates.. pass a delegate to
the form allong with an object array of params, and the form can
invoke the delegate. This would work fine but in my opinion the
interface method is a cleaner implementation.

CallByName uses late binding and reflection internally and has a lot
of overhead that isn't necessary for the task.

HTH,

Sam
On Fri, 7 Jan 2005 10:13:02 -0800, "Rob R. Ainscough"
<ro*****@pacbell.net> wrote:
I use a generic Processing form (modal) where I pass it an object and
method
name and parameters if needed and then use CallbyName to execute the
passed
in method. What this does for me is lock out user input on the parent
form
as the Processing form has no input controls until all processing is
complete.

I was curious if CallByName is a good way to perform this operation?

Nov 21 '05 #3

So what's wrong with using a Delegate? That's generic.

I don't think CallByName would be a performance problem in your case
since it's only called once for a large operation, but in my opinion
it's a bad function to use. I fall in "program the VB.NET without VB
camp". In general, when a OOP/.NET mechanism exists to accomplish the
same goal, I would opt for that alternative. Delegates would work
well for your situation.

Sam
On Fri, 7 Jan 2005 11:13:56 -0800, "Rob R. Ainscough"
<ro*****@pacbell.net> wrote:
Unfortunately the purpose of the Processing form is to be generic in nature
so the methods and objects are not known ahead of time. The CallByName is
only used once (not used in a loop).

Do you have any specific numbers to indicate the overhead of CallByName vs.
another approach?

Thanks, Rob.


Nov 21 '05 #4
Sam,

Hmmm...yes the Delegates approach may just work for me -- and appears it
might be about the same coding effort.

Thanks, Rob.

"Samuel R. Neff" <bl****@newsgroup.nospam> wrote in message
news:di********************************@4ax.com...

So what's wrong with using a Delegate? That's generic.

I don't think CallByName would be a performance problem in your case
since it's only called once for a large operation, but in my opinion
it's a bad function to use. I fall in "program the VB.NET without VB
camp". In general, when a OOP/.NET mechanism exists to accomplish the
same goal, I would opt for that alternative. Delegates would work
well for your situation.

Sam
On Fri, 7 Jan 2005 11:13:56 -0800, "Rob R. Ainscough"
<ro*****@pacbell.net> wrote:
Unfortunately the purpose of the Processing form is to be generic in
nature
so the methods and objects are not known ahead of time. The CallByName is
only used once (not used in a loop).

Do you have any specific numbers to indicate the overhead of CallByName
vs.
another approach?

Thanks, Rob.

Nov 21 '05 #5
For some info on the performance hit see:

http://msdn.microsoft.com/library/de...stringname.asp
--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com

"Rob R. Ainscough" <ro*****@pacbell.net> wrote in message
news:ux**************@TK2MSFTNGP12.phx.gbl...
I use a generic Processing form (modal) where I pass it an object and
method name and parameters if needed and then use CallbyName to execute the
passed in method. What this does for me is lock out user input on the
parent form as the Processing form has no input controls until all
processing is complete.

I was curious if CallByName is a good way to perform this operation?

Nov 21 '05 #6
See MethodInfo Class and it's .Invoke member

Dim myType As Type = objClass.GetType()
Dim myMethod As MethodInfo = myType.GetMethod("strFnName")
myMethod.Invoke(objClass, Args)

where "strFnName" is your method name and "Args" is an array of parameter
values (objects) for the method's arguments in the same order.
"Rob R. Ainscough" wrote:
I use a generic Processing form (modal) where I pass it an object and method
name and parameters if needed and then use CallbyName to execute the passed
in method. What this does for me is lock out user input on the parent form
as the Processing form has no input controls until all processing is
complete.

I was curious if CallByName is a good way to perform this operation?

Nov 21 '05 #7
For some info on the performance hit see:

http://msdn.microsoft.com/library/de...stringname.asp
--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com

"Rob R. Ainscough" <ro*****@pacbell.net> wrote in message
news:ux**************@TK2MSFTNGP12.phx.gbl...
I use a generic Processing form (modal) where I pass it an object and
method name and parameters if needed and then use CallbyName to execute the
passed in method. What this does for me is lock out user input on the
parent form as the Processing form has no input controls until all
processing is complete.

I was curious if CallByName is a good way to perform this operation?

Nov 21 '05 #8
See MethodInfo Class and it's .Invoke member

Dim myType As Type = objClass.GetType()
Dim myMethod As MethodInfo = myType.GetMethod("strFnName")
myMethod.Invoke(objClass, Args)

where "strFnName" is your method name and "Args" is an array of parameter
values (objects) for the method's arguments in the same order.
"Rob R. Ainscough" wrote:
I use a generic Processing form (modal) where I pass it an object and method
name and parameters if needed and then use CallbyName to execute the passed
in method. What this does for me is lock out user input on the parent form
as the Processing form has no input controls until all processing is
complete.

I was curious if CallByName is a good way to perform this operation?

Nov 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: sandy | last post by:
Hi All, I am a newbie to MySQL and Python. At the first place, I would like to know what are the general performance issues (if any) of using MySQL with Python. By performance, I wanted to...
10
by: headware | last post by:
I know that you can call the method of one from from inside another form by doing something like this Forms("MyForm").MyFunction(12, 34) However, you have to know that MyForm has a function...
5
by: Edlueze | last post by:
I use the CallByName function quite regularly, but the sub routines that I have always called have been located within the form code. The call I use looks something like this: Dim CallObjectForm...
4
by: Martin | last post by:
I am using graphics as backgrounds for forms,buttons,labels etc. The question is: is it faster to load all graphics from files on app start or to use it embeded (places in editor during design)....
7
by: Li Pang | last post by:
Hi, I'd like to know how to call a sub/function bu using a string containing its name, as an example as follow: Sub Main() Dim name As String = "TestMe()" ' need help here End Sub
1
by: Kishor | last post by:
Hi all, I am facing one problem with callbyName. I am facing one problem, instead of describing this I am pasting this code. I wanted to know is there any other way to avoid this error and make...
16
by: Dennis | last post by:
I have a class named "myclass" and an arraylist containing elements of type "MyClass". I want to get the value of a property of "MyClass" (a string type) for one of the arraylist elements. I...
0
by: Phill. W | last post by:
I have a Console application (which will wind up running on a remote host). This has two Threads - the main processor and a second that provides a socket-based way of "talking" to the first. ...
1
by: Fredrik Melin | last post by:
Hi, We had real bad problems with reports being printed wrong (active reports ..net 2.0), which we tracked down to being because before we printed the report we used CallByName to READ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.