What a shame it requires .net framework to run :(-PhilB66 (October 23, 2010, 11:08 AM)
Darwin and all the other i..... haha, just kidding around but that's my weird sense of humor,
I sincerely apologize for being so harsh in my response. I know I could have made my point clear without being so rude. I was just a bit ticked off at that moment... sorry. :-[-PhilB66 (October 24, 2010, 07:58 PM)
<snip>
There's a few relevant issues with it, though:</snip>
- .NET appsare more memory-hungry than native equivalents, and there's CPU-speed overhead as well - although it's not as easy as saying "always slower", but that's a topic on it's own.
-f0dder (October 24, 2010, 04:05 PM)
The GC in .NET also forces .NET programs to have poor locality, i.e. it interacts with local system resources in an often less-than-optimal manner, namely becasue they often consume more memory than they actually use.Unless I misunderstand what you're writing, that's not what I understand as locality (http://en.wikipedia.org/wiki/Locality_of_reference). Yes, .NET heap can be compacted and stuff can move around, but you should generally get fine locality as long as you're using contiguous data structures... you might get temporary bumps because of compacting, but if your data lives long enough to suffer from this, it'll probably end up on the gen2 heap and not be affected much after that :)-wraith808 (October 25, 2010, 09:22 AM)
JAVA us better?Nope :) (well, I don't know enough of the internals to say which environment has the upper hand head-to-head, but they use similar techniques). I'm in favor of .NET (for a lot of things), btw, if that didn't come across clearly enough :)-LangOver (October 25, 2010, 09:59 AM)
Could a moderator perhaps split out the whole stuff-about-.NET to a separate thread so it doesn't distract from LangOvers product announcement? - sorry for continuing the off-topicness :)-f0dder (October 25, 2010, 10:18 AM)
Well, if the topic is going to be split, this reply is also going with it, so... :)Could a moderator perhaps split out the whole stuff-about-.NET to a separate thread so it doesn't distract from LangOvers product announcement? - sorry for continuing the off-topicness :)-f0dder (October 25, 2010, 10:18 AM)
I'll wait until this is done to continue discussion. :Thmbsup:-wraith808 (October 25, 2010, 11:29 AM)
Update: Though since I had to post to say that, let me just say when I say appear to use more, I mean because memory is still allocated to the application that is not actually in use; when you dispose of objects, the memory is not freed immediately. This can't rightly be said to be used by the application since the developer is not using the objects... the memory is still just in that application's space.The application might not be 'using' the memory, but the thing that counts wrt. memory footprint is the Win32 Private Bytes size, not the amount of CLR memory. Keep in mind that even after GC has run, the win32 memory used by the CLR isn't necessarily reduced.-wraith808 (October 25, 2010, 11:29 AM)
well, .NET apps don't just appear to use more memory than an equivalent native app, they use more memory; one reason is the structure of the .NET library and the idioms around it-f0dder (October 25, 2010, 09:50 AM)
For example, the immutability of strings allows the reuse of a single instance of a string value, without allocating multiple redundant values.Possible even in C++, although that's usually implemented with COW (http://en.wikipedia.org/wiki/Copy-on-write), which can be a bottleneck in multi-threaded apps.-CWuestefeld (October 25, 2010, 12:30 PM)
If you are trying to reduce the total amount of memory your application allocates, keep in mind that interning a string has two unwanted side effects. First, the memory allocated for interned String objects is not likely be released until the common language runtime (CLR) terminates. The reason is that the CLR's reference to the interned String object can persist after your application, or even your application domain, terminates. Second, to intern a string, you must first create the string. The memory used by the String object must still be allocated, even though the memory will eventually be garbage collected.-http://msdn.microsoft.com/en-us/library/system.string.intern.aspx
Also, the CLR design of generics is much more efficient than any other language/platform that I'm aware of. In some cases this can allow the source code to be much smaller. Basically, the definition of MyGeneric<MyClass> only needs to be stored once; whereas C++ for example must separately compile this for each different MyClass that's used.Might be true for the IL code generated, but what happens when the JIT'er runs? :) - also, there's object allocation overhead every time you use a delegate... which includes the very innocent-looking lambda expressions. Setting up the closures might be relatively inexpensive, but it isn't free (I measured a 10x speed hit in object serialization because of a INotifyPropertyChanged implementation using lambda expressions).-CWuestefeld (October 25, 2010, 12:30 PM)
In general, then, some kinds of programs will take more memory, and some may take less. But that's really comparing the same program, ported to different platforms. I'm betting that if you design your code from the ground up with an understanding of .Net (or whatever platform you're building for), you should be able to come up with a design that meshes well with whatever criteria are important to you.Wise words. Idiomatic .NET (at least C#) programming does tend to involve a fair amount of objects being created, though. Fortunately a lot of them are short-lived and get collected fast, not putting much pressure on the win32 memory. Still, there's a fair amount of memory overhead from the framework. This becomes pretty inconsequential on larger apps that need a lot of memory for <whatever> processing, but it can be noticable on small tools. Whether this matters depends on the situation :)-CWuestefeld (October 25, 2010, 12:30 PM)
Might be true for the IL code generated, but what happens when the JIT'er runs?-f0dder (October 25, 2010, 02:27 PM)
there's object allocation overhead every time you use a delegate-f0dder (October 25, 2010, 02:27 PM)
which includes the very innocent-looking lambda expressions. Setting up the closures might be relatively inexpensive, but it isn't free-f0dder (October 25, 2010, 02:27 PM)
Update: Though since I had to post to say that, let me just say when I say appear to use more, I mean because memory is still allocated to the application that is not actually in use; when you dispose of objects, the memory is not freed immediately. This can't rightly be said to be used by the application since the developer is not using the objects... the memory is still just in that application's space.The application might not be 'using' the memory, but the thing that counts wrt. memory footprint is the Win32 Private Bytes size, not the amount of CLR memory. Keep in mind that even after GC has run, the win32 memory used by the CLR isn't necessarily reduced.-wraith808 (October 25, 2010, 11:29 AM)-f0dder (October 25, 2010, 12:06 PM)
wraith808, garbage collection is done entirely at the CLR's mercy; depending on win32 memory process and which heap generation your object is in, when it's collected can vary a lot. This is just one of the reasons why you shouldn't depend on finalizers being called. Furthermore, just because a bunch of your CLR objects are being collected doesn't mean the used win32 memory is released - this makes sense because allocating system memory is "slow", so (if you're thinking only of the running .NET process and not the entire system) it makes a lot of sense to hang on to the win32 memory even if it's no longer strictly needed.
There's several different GC profiles your app can use, with different heuristics for when and how the GC works. There's also manual GC interaction you can do, but you should be really careful about this since it can seriously pessimize your app performance.-f0dder (October 25, 2010, 04:14 PM)
- .NET doesn't get really interesting to program in before 3.0, which minimum OS requirement is XP-SP2. Some people are still using older OSes.
-f0dder (October 24, 2010, 04:05 PM)
That sentence is 99% correct.Mono is a decent project, but it doesn't have WPF support - that's a big showstopper IMHO.
However, Mono comes to the rescue. My windows 98 box (Windows 98SE, 256MB ram) is running several programs that equire .NET 3.0+. :D-kamahl (November 02, 2010, 09:14 PM)
I do have my own list of issues with .NET, but they are more about the C# language specifically:The first two items on your list are .NET framework, not C#, issues :)
- System.Windows.Forms: Why came up with the idea that data (Listboxes specifically [They're wonderful things, all things considered]) should be kept on the control, and not in a database somewhere. And not only that, said data is in a read-only collection.
- Most Collections have no .sort() method.
- The Following code snippet
-kamahl (November 02, 2010, 09:14 PM)
#3 - ugh. You're approaching things wrongly :) - exactly how to do things right depend on whole bunch of things, though. But in general, you'll want to bind your controls to objects (as opposed to string/int/whatever representations of individual properties) and use proper sorting: check out IComparable<T> and IComparer<T> interfaces. There's several ways to handle sorting, and there's more to it than just the sorting itself... for instance, it's often better practice to not sort your object data directly, but bind the GUI element to a filter/sort adapter that constructs the binding collection from it's source collection.-f0dder (November 03, 2010, 12:58 AM)
One of the real pains of distributing a dot net application seems to be worrying about and figuring out ways to deal with the situation where a required edition of the dot net clr isnt installed.-mouser (November 03, 2010, 07:51 AM)
DreamShield is a publishing tool through which it is possible to create installers to publish Microsoft .NET based applications. You can also choose whether to include the setup of the .NET Framework itself with your package for an easy distribution. It is possible to create setup then put them on a CD or to create a self-extracting archive with only one application in order to allow an easy downloading from a website.