Loading ...
Sorry, an error occurred while loading the content.

Re: [pcgen_developers] memory usage

Expand Messages
  • Chris Dolan
    For most of those genetic metrics, I recommend Sonar. It needs maven pom.xml but otherwise is really easy to set up. Chris ... For most of those genetic
    Message 1 of 22 , Jan 30, 2013
    • 0 Attachment
      For most of those genetic metrics, I recommend Sonar. It needs maven pom.xml but otherwise is really easy to set up.

      Tom Parker <thpr@...> wrote:

      Number of java warnings
      Processing time per character regression test
      Load errors/warnings for key dataset combinations
      Unit test coverage

      ...probably a lot more, but there are a lot of interesting things we could graph over time if someone was up to the task.  Like many other things, just not my top priority.

      Tom Parker

      From: Henk Slaaf <henk@...>
      To: pcgen_developers@yahoogroups.com
      Sent: Wednesday, January 30, 2013 12:58 PM
      Subject: Re: [pcgen_developers] memory usage

      Hey all,
      It would be cool if Jenkins could run a memory benchmark of every commit for a few sample characters to see what effects commits have.
      Then we could graph the results.
      No idea if this is actually feasible, but just dreaming :-)
      On Jan 25, 2013 9:25 AM, "Chris Dolan" <chris@...> wrote:
      As a performance metric, I wrote a simple desktop app that loads a single (hard-coded) Pathfinder PCGen character and renders it with the CharacterSheetPanel. I measured time to load (about 40 seconds) and resulting memory usage (about 85 MB of heap when idle).

      My test app is at the URL below (less than 200 lines of code): https://github.com/chrisdolan/pcgen-android/blob/acf2de4e874697329246b9378525f7fc4852f344/pcgenuitest/src/net/chrisdolan/pcgen/viewer/uitest/HtmlSheet.java

      Then I went through the PCGen source looking at all of the Lst loading paths and I added lots of .intern() clauses to the tokenined input to detach them from the original file strings. This saved a notable amount of memory (now 790 MB instead of 85 MB), but much less of an improvement than I hoped. My intern changes are visible on this git branch commit:

      I've attached a pretty chart of the heap dominators before and after my change, according the Eclipse MAT plugin. I believe that the heap associated with the AppClassLoader is the static fields, like in SystemCollections, but I'm not sure. It's not surprising that Equipment is the #1 user.

      BEFORE: (note that "char[]" is the 4th biggest, not sure why the HTML classes don't show. Maybe I made a mistake?)
      AFTER: (note that "char[]" has vanished, AppClassLoader has shrunk, and the others are about the same)


      P.S. I had an interesting discussion on StackOverflow about String.intern(). Take a look:

    Your message has been successfully submitted and would be delivered to recipients shortly.