C# optimization

P

Per Larsen

....
Just out of interest (and this is straying off topic, but it's
something that interests me) why do you think that is? I've always
found it *much* quicker to write a small console project to do
something than a GUI project. You don't even need to fire up VS.NET to
write a console project quickly, but even if you *do*, there's no
mucking around putting a button in or whatever - you just put the code
in Main and run it.
I'm not having a go at you personally - I'm just wondering why everyone
else seems to find it quicker to write short GUI programs than short
console programs. I see it pretty much every day, and my natural
inclination when everyone else does something differently to me is to
ask why - it usually means I'm missing something. Am I in this case?

Well, I don't know about everyone else, but I keep VS.NET running all day
with the project du jour open. When something like this comes up, what could
be easier than dropping an extra button on the form that you happen to be
working on and then type in the test code right there? :)
It's not just forms. It's any class which derives from
MarshalByRefObject. I suspect there are some good reasons somewhere,
but hopefully they'll have been ironed out by the time Whidbey comes
out.

I can't claim to fully understand the rationale either, but MarshalByRef
implies that the CLR must be able to replace all method calls with calls to
a proxy object. That wouldn't be possible if the calls were inlined
verbatim. It seems a bit odd in the first place, though, that forms inherit
from MarshalByRef since I would think that using forms across app domains
would be the exception rather than the rule. Oh, well.
I don't know whether or not there are other optimisations it doesn't
perform as well as inlining, by the way.

I don't either, but I've submitted a request for further documentation to
the .NET performance doc team not too long ago, so hopefully we'll see
something from them soon.

- Per
 
D

Daniel Billingsley

Ah, that makes sense. I take the approach of Jon too, just firing up a
console app I have sitting around for such purposes. I guess one big
difference for me is that the app du jour is not typically a winform app for
me, so it comes down pretty much to just that I think.
 
N

NigelW

I use a form as its very quickly set up with a wizard and
if the code grows to justify a GUI, its already set up.
Often when starting with a command line application, I end
up moving it to a GUI anyway.

Nigel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top