It's a trade-off, because most molecules will use that space and if you add things on you don't want to keep add things on. Memory works in cache lines and pages so trying to save a few bytes compacting the rare cases is not worth.
The default in Java collections is 10 or so I believe (see https://www.baeldung.com/java-list-capacity-array-size#:~:text=Technically%2C%20the%20default%20capacity%20(DEFAULT_CAPACITY,is%20added%20to%20the%20list.), it turns out the avg drug like molecule is 26 atoms/bonds or so. On Fri, 7 Jul 2023 at 10:39, FB <jonny.baen...@web.de> wrote: > Hi, > > I noticed that small molecules like methane or ethane have zero elements > in their bonds or atomic arrangements. I did some quick research and saw > that the arrays in AtomContainer2 are expanded to a default size of 20. > I wondered why the arrays are not trimmed after successfully creating an > AtomContainer? > I am just asking out of interest, as we have discussed this point in our > working group. > > Best regards, > Felix > > > > _______________________________________________ > Cdk-user mailing list > Cdk-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/cdk-user >
_______________________________________________ Cdk-user mailing list Cdk-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cdk-user