#110 Test if static String[] help performance and memory

open
nobody
None
5
2012-10-08
2008-07-17
Egon Willighagen
No

On Thu, Jul 17, 2008 at 6:24 AM, Rajarshi Guha rguha@indiana.edu wrote:

On Jul 17, 2008, at 12:19 AM, Egon Willighagen wrote:

On Thu, Jul 17, 2008 at 5:13 AM, rajarshi@users.sourceforge.net wrote:

  • public String[] getDescriptorNames() {
  • return new String[]{
  • "PPSA-1", "PPSA-2", "PPSA-3",
  • "PNSA-1", "PNSA-2", "PNSA-3",
  • "DPSA-1", "DPSA-2", "DPSA-3",
  • "FPSA-1", "FPSA-2", "FPSA-3",
  • "FNSA-1", "FNSA-2", "FNSA-3",
  • "WPSA-1", "WPSA-2", "WPSA-3",
  • "WNSA-1", "WNSA-2", "WNSA-3",
  • "RPCG", "RNCG", "RPCS", "RNCS",
  • "THSA", "TPSA", "RHSA", "RPSA"
  • };
  • }

I was wondering if the code performance would increase if such static
labels String[] was made a private final static instead of creating a
new String[] each time...

Possibly - but I'd think other aspects (such as surface area calculation)
will overshadow that performance hit. Also, it would only be applicable to
descriptors with fixed-length values (i.e., not dependent on params)

True, but for memory allocation it would do much good, not? If this
array gets allocated once for each molecule, I can imagine that it
will put some stress on the garbage collection in a HTVS setting, not?

Discussion