|
Hmm... I'm not sure right off if there's a way to pre-load them, but you might instead try ngen'ing them when they're installed, so that thy don't have to be JIT compiled when they're loaded.
|
|
|
|
|
The problem with ngen is that it hurts the runtime performances. Preloading the assemblies would be the best solution for me since I can tolerate a delay while loading the application (a splash screen could inform the user of what's going on), but slow responsiveness is not an option for us.
Thanks!
Carl
|
|
|
|
|
Carl Mercier wrote:
The problem with ngen is that it hurts the runtime performances.
So slightly that you won't notice it, if any at all. What ngen does is just pre-compiles the executable into a native image, the same way it would be done at runtime with JIT.
|
|
|
|
|
Carl is correct - ngen'ing things does introduce an extra level of indirection to all assembly level statics. This can be a significant performance hit in some situations. There is no way to definatively state that ngen will be a win or a loss for a given application, the only thing you can do is profile it both ways yourself.
Through version 1.1 ngen's target is really for use with the framework assemblies themselves. Don't assume it's actually a win for your application. There's a good piece of this in one of the gotdotnet blogs recently but I don't have a link handy.
--
-Blake (com/bcdev/blake)
|
|
|
|
|
Blake Coverett wrote:
There is no way to definatively state that ngen will be a win or a loss for a given application, the only thing you can do is profile it both ways yourself.
It looks like this just may be a case where it is a win, though.
|
|
|
|
|
No, that was my point, there is _no_ way to tell a priori if it will be a win, you have to test and time for the specific application. And then of course, you have to figure out how you will handle the fact that anytime a CLR service pack is installed after your application you lose your ngen'd images. It is a hard problem and not well supported with the current tools.
--
-Blake (com/bcdev/blake)
|
|
|
|
|
Blake,
Do you know any way of preloading the assemblies by any chance?
Thanks
|
|
|
|
|
Heh, I guess we did get distracted from the original question there - sorry.
I guess the correct answer is, that depends. What do you mean by 'loading the assembly'. You can certainly force assemblies to be loaded manually whenever you want via System.Reflection.Assembly.Load(AssemblyName), you could have a bunch of those at the top of your Main().
Whether this really gives the effect you want is unclear though. This will cause the assembly to be mapped and the metadata parsed, but nothing will be JITed, that still happens on a mostly per method basis.
As an aside, here is the blog entry[^] I mentioned earlier about ngen.
--
-Blake (com/bcdev/blake)
|
|
|
|
|
Hi!
That gives me some hint. However, since you say nothing will be JIT'ed, it won't work for me. I have thought about adding a dummy shared method to all my classes and call them one after the other. Will the whole assembly get JIT'ed or only the dummy method will be compiled?
Thanks!
Carl
|
|
|
|
|
Even in your initially executing assembly methods are JITed on demand. Calling one method in an assembly does not force the rest to be JITed.
I suspect you are chasing a bit of a phantom here - how do you actually know that forcing your assemblies to be loaded and compiled at process creation is actually what you want? Like all performance matters, the only answer is to measure - guessing what will improve performance without profiling is extremely prone to error.
--
-Blake (com/bcdev/blake)
|
|
|
|
|
Dear All,
I wanted to know whether there is a way to solve this problem or not?
The problem is as I describe it here:
There is already a program written and it has to access a directory which the user working with this program does not have access. I know how to set an impersonation context in a program I (I mean I) am writing. But the problem here is that this program is already written and compiled and I do not have access to source files to add this impersonation solution to the source code. So I need a way to change the user which is logged in toa user that has access to that folder and run the program in a way that impersontion context is copied for that program so this program can use iot to access the folder.
Please help me through this problem.
Thanx Alot
|
|
|
|
|
Sounds like P/Invoke time. Read up on LogonUser and CreateProcessAsUser on MSDN.
--
-Blake (com/bcdev/blake)
|
|
|
|
|
Or CreateProcessWithLogonW() which is easier.
Mazy
No sig. available now.
|
|
|
|
|
Good catch, assuming it doesn't need to run on NT4 - which one would hope is getting to be a safe assumption these days.
--
-Blake (com/bcdev/blake)
|
|
|
|
|
According to MSDN both are the same except seconnd on one need W2K ot higher and it is easier to use.
Mazy
No sig. available now.
|
|
|
|
|
Hi,
Please look at the code and let me know the error !
System.Reflection.Assembly thisExe;
thisExe = System.Reflection.Assembly.GetExecutingAssembly();
string[] t = thisExe.GetManifestResourceNames();
foreach (string s in t)
{
System.IO.Stream str = thisExe.GetManifestResourceStream(s);
Console.WriteLine(str.GetType().ToString());
}
The result is :
"System.IO.__UnmanagedMemoryStream" for all resources.
Why ? Any suggestions ?
Paul
|
|
|
|
|
Hi,
i guess because you write out the type of the stream class, not of the content. stream.GetType() is not equal to stream content type.
.:[Greetz from Jerry Maguire]:.
|
|
|
|
|
Remoting client can subscribe to event supported by a Remotable object:
IncomingDelegate d = new IncomingDelegate(this.SomeHandler);
MyRemoteObj.evIncoming += d;
That's simple enough. But what if you want to subscribe to event on server side? Thanks.
norm
|
|
|
|
|
I believe you would have to switch roles and set up a remotable object on the client PC that would act as a server to the Server PC. (If that all makes sense )
When I can talk about 64 bit processors and attract girls with my computer not my car, I'll come out of the closet. Until that time...I'm like "What's the ENTER key?"
-Hockey on being a geek
|
|
|
|
|
Hello everyone,
I am trying to make use of a datagrid loaded with data from a database. I have the datagrid displayed and filled with data, but I am having a problem with the double-click event and the keypress event. The datagrid will not pick up either one of those events unless the focus is on the Row Header all the way to the left of the row. I need to be able to double-click on a specific cell and use the data within that cell. The CellChanged event would work, but it does not need to occur on a single-click, only a double-click. Any ideas????????????????
Thanks,
Kendal
|
|
|
|
|
I have created a very simply Windows Service.
I know the service runs because the event view shows it runs and the service writes a short text file as extra proof it is running.
What I would like the service to do is called an old C++ FormView based application. So I haved coded a process call like this;
OnStart()
{
Process myProcess = Process.Start("C:\\TestDir\\TestProcess.exe");
}
The "TestProcess.exe" also runs, again it writes to a text file to prove it has run.
But the TestProcess (which is FormBased-FormView) displays no visible window. My question is- how can I see the Form of the TestProcess, is there a way to make it visible?
thanks
|
|
|
|
|
Services run on a different WindowStation from the interactive user. This is by design. You need to back up and reconsider your plan here - a service runs all the time, what would you expect to happen to that TestProcess GUI application as a user logs in and back out all while you service is still running?
--
-Blake (com/bcdev/blake)
|
|
|
|
|
Can you set COM+ attributes at runtime inside you code? Thanks.
norm
|
|
|
|
|
I complied unmanaged C++ code to .dll and call the method in .NET.
I have found that the memory of a pointer is freed more than one time. The block used for freeing memory is as under.
int *p;
p = memalloc(sizeof(int)*100);
...
if( p != NULL)
{
free(p);
p = NULL;
}
Even though it has been checked if p not equal to NULL while calling this code from .NET aware language the assertion is thrown by .NET run time!!! What should be done for this issue?
|
|
|
|
|
try using __nogc*
|
|
|
|