POV-Ray : Newsgroups : povray.off-topic : compiling huge C++ files : Re: compiling huge C++ files Server Time
6 Sep 2024 19:20:12 EDT (-0400)
  Re: compiling huge C++ files  
From: Kevin Wampler
Date: 3 Nov 2008 16:44:54
Message: <490f70d6@news.povray.org>
Warp wrote:
> Kevin Wampler <wampler+pov### [at] uwashingtonedu> wrote:
>> I'm attempting to compile some auto-generated code, and am running into 
>> problems with turning on optimization flags due to the large side of the 
>> files generated (.cpp file is currently 25MB, and could be as large as 
>> 200MB later).  There is no natural way to break this code into smaller 
>> pieces and such large auto-generated files really are necessary, so I'm 
>> stuck with having to compile some really huge C++ files.
> 
>   That's rather large. Are you sure it's the only way?

It may be possible to re-formulate my problem to generate less code, but 
  unfortunately there's no way to do it that's particularly easy, or 
that I'm entirely sure will work.

The auto-generated code itself is necessary because I do some 
computations which involve complete knowledge and manipulation of the 
function-composition graph which I eventually write to C++.  It's 
technically possible to avoid this, but it would be at a large cost in 
code complexity and would probably result in significantly slower code 
(defeating the purpose of such a change).

I can compile things perfectly well if I don't specify any optimization 
flags, so it's not a disaster if I can't get g++ to cooperate -- it will 
make make things somewhat less convenient.

>> 1) Is there any way to specify for g++ to only to use optimizations 
>> which do not require a significant amount of storage to compute?
> 
>   If you run "info gcc" and the choose Invoking GCC > Optimize Options
> you will get a detailed documentation of all the optimization flags gcc
> supports. You can try turning then on one by one and see which ones
> require significant amounts of memory and which ones don't.

Ahhh, I had tried to google for that information, but with little 
success.  That is extremely helpful, many thanks!

>> 2) Is there another compiler that works under linux (fedora 9) that 
>> might handle this better?  I should be able to find a version of the 
>> Intel compiler to use if someone has reason to think it'll perform better.
> 
>   I have no idea if it will perform better, but it doesn't hurt to try.

Fair enough.  The main reason I asked was because it'll probably take 
some effort to track down a version I can use (since it's not free), but 
you're probably right that it's a relatively easy thing to try.

>> 3) Can I change the format of the source code so that using g++ 
>> optimizations isn't as necessary?  Most of the execution time is spent 
>> in my auto-generated code, which looks something like this:
> 
>   Are you sure you can't precalculate things in your code generator?

To what degree this is possible I already do, including removing any 
computations which don't influence the result and precomputing anything 
which only involves constants.

It's possible I could do some algebraic optimizations (factoring out 
common multipliers, etc) to reduce the code size, but that's starting to 
become a rather more process difficult than I'd like.

I'll start off with setting the g++ optimization flags from the info 
file you pointed out, since that seems easiest.


Post a reply to this message

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