[sldev] [VIEWER] Dead code removal

Dirk Moerenhout blakar at gmail.com
Tue Sep 4 06:22:58 PDT 2007


True but I'm mostly referring to parts of newview and I hope it is at
least so that this is never used by the server code. It might even be
a good question: What do we really share with the server code? I guess
we probably share llcommon but what other parts are dangerous too?

Dirk aka Blakar Ogre

On 9/4/07, Adam Frisby <adam at gwala.net> wrote:
> Remember -- "a" and "b" can come from the server code which shares a lot
> of code with the viewer. Be careful when submitting patches that removes
> classes like that, since it may still be required for the sim.
>
> Adam
>
> Dirk Moerenhout wrote:
>
> > I've been working on particles and have run into quite a lot of dead
> > code. What are we supposed to do with it?
> >
> > I consider it dead if:
> > a) It's a class, method ... that is never referenced (or only
> > referenced by elements that are in turn dead)
> > b) A conditional statement that has only one possible result is
> > keeping the code from being executed
> > c) The code is executed but the result is unused
> > d) It's a placeholder returning a default value.
> >
> >
> > Personally I'd like to remove all of it. More extensive reasoning for each case:
> > a) The logic in unreferenced code hasn't been tested ever since it
> > became dead. As such newer changes may have invalidated the code or
> > may conflict with it. Yet people will feel inclined to bring it back
> > from the dead or may reference it without knowing it's no longer up to
> > date.
> >
> > b) Same as in case a applies and additionally there are other
> > concerns. The condition will most likely still eat CPU cycles and
> > you're likely wasting memory on the code and it's data elements as the
> > compiler can't always see the condition will never be met.
> >
> > c) This is a tricky one. In come cases there's code that seems just
> > fine but somewhere else the results are thrown away and replaced. As
> > such the code results into nothing and there's no knowing whether the
> > result would have had value. This can also eat a lot of CPU cycles if
> > the dead part is CPU intensive (there is in fact pointless code in
> > loops).
> >
> > d) Several functions just return simple values while they are supposed
> > to do true calculations. This gives a bit of useless overhead and it
> > makes the code ugly and hard to understand. While it does point out
> > sometimes that something is missing it does at the same time hide that
> > things are missing as not everybody will check whether a method really
> > returns somethings useful or not.
> >
> > Is it ok to submit a patch for this? I've split my particles stuff in
> > pieces and the first part of it now is an extensive dead code removal
> > patch (only for particle related dead code off course). It helps speed
> > up code as it removes CPU and memory taxing pieces and it also makes
> > the code easier to understand and read.
> >
> > Dirk aka Blakar Ogre
> > _______________________________________________
> > Click here to unsubscribe or manage your list subscription:
> > /index.html
> >
>
>


More information about the SLDev mailing list