Performance of shared function in clas vs. independent class

  • Thread starter Thread starter Chandy
  • Start date Start date
C

Chandy

Hi,

I have a public shared function in a utility class full of other public
shared functions. It does not get hit that often but when it does the
hit will be long-ish and involve potentially thousands of operations,
though it does not make calls to any other non-system assemblies. What
can I do within .Net to mitigate against this becoming some sort of
bottleneck? For instance, should I move it into it's own assembly?

TIA

Chandy
 
Chandy said:
I have a public shared function in a utility class full of other public
shared functions. It does not get hit that often but when it does the
hit will be long-ish and involve potentially thousands of operations,
though it does not make calls to any other non-system assemblies. What
can I do within .Net to mitigate against this becoming some sort of
bottleneck? For instance, should I move it into it's own assembly?

Why would it become a bottleneck? I don't see any reason to move it.
 
Chandy said:
I have a public shared function in a utility class full of other public
shared functions. It does not get hit that often but when it does the
hit will be long-ish and involve potentially thousands of operations,
though it does not make calls to any other non-system assemblies. What
can I do within .Net to mitigate against this becoming some sort of
bottleneck? For instance, should I move it into it's own assembly?

If this method should become a bottleneck, it wouldn't have anything to
do with the class it's defined in or the assembly or anything like that.
You couldn't speed it up by moving it somewhere else.

To speed the method up, you'd have to analyze it, possibly with the help
of profiler software, and restructure or rewrite parts that don't
perform as well as you want them to.

If calls to the method in question slow down the general performance of
your application because they take long to return, you could try using
separate threads for the long-running operations, so that the rest of
your application (especially the GUI) is not effected.


Oliver Sturm
 
Dunno, I don't know enough about the way threading works. I think I
was thinking more a bottleneck for processess that use other methods
within the same assembly but I guess that's daft. Sounds good, I'll
leave it then.

Thanks.
 
Chandy,

With the exception that you have a multiprocessor computer, will splitting
up your process in more processes never speed up the througput, moreover it
will slow it down.

If your process is visible slow, than I would look if there are no processes
that are maybe not needed repeatly done.

By instance if you use often a property that needs a lot of processing, than
it can sometimes be better to create for that an extra property that holds
the value without processing.

Just my thought,

Cor
 
Back
Top