POV-Ray : Newsgroups : povray.off-topic : Learning C# : Re: Learning C# Server Time
29 Jul 2024 04:24:36 EDT (-0400)
  Re: Learning C#  
From: Darren New
Date: 29 Sep 2012 13:40:06
Message: <50673276$1@news.povray.org>
On 9/29/2012 3:18, Orchid Win7 v1 wrote:
> This, it is claimed, can reduce page faults, improve cache performance, and
> so forth.

Reducing the working set is independent of how much code you have. It 
depends on how much code you're working with right at this very moment. The 
author doesn't understand the concept of "working set".

Working set is, roughly, the number of pages you're accessing faster than 
paging in swapped-out pages is fast enough to keep up with. If you have a 
300-meg executable in a tight loop 23K in size, you have a 23K working set.

> Yes, that's right. Your application is using 250MB of heap space, but the
> executable binary is 4KB smaller, and that's the important thing, right?

The part of the heap you're using is also part of the working set.

>> I have seen several arguments in the past that C++ templates
>> are bad because they increase code size, thus increasing memory usage.

Well, C++'s target platforms include things that C# isn't targeted at. If 
you're trying to fit your code into a credit card terminal, you're going to 
be worried about C++ template code bloat and the features of C#'s execution 
model won't even enter the conversation.

>> In other words, their solution to the "huge" "problem" of increased code
>> size is to increase memory usage ten-fold in order to make the executable
>> binary slightly smaller. Great job.
>
> Yeah, that's about the size of it.

Nah. I'm pretty sure C# generics use the same code for each reference type. 
I.e., you might have a version for int, a version for float, and one version 
for anything descended from Object.

The reason C++ makes more code is that it actually does stuff like inline 
the right calls, doing type-specific generic expansions. C# doesn't do that, 
so I think you get far fewer versions of the code. Especially for generics 
that are anchored, i.e., that are generic over some specific superclass.

-- 
Darren New, San Diego CA, USA (PST)
   "They're the 1-800-#-GORILA of the telecom business."


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.