BUG-1270: improve QNameModule reuse

This eliminates calls calls which were causing unneeded QNameModules to
be instantiated, reducing memory overhead.

Change-Id: I5faa53fa8a5f82ae8b87fde67c0e69271595ce94
Signed-off-by: Robert Varga <rovarga@cisco.com>
BUG-1270: BaseTypes should reuse QNameModule

This is a simple enough conversion, allowing us to get rid of some
duplicate QNameModule instances.

Change-Id: Ia4292ebb387c1c4a78710e588aa3aca6454fa2d9
Signed-off-by: Robert Varga <rovarga@cisco.com>
BUG-1270: ExtendedType used empty ArrayList

If the unknownNodes list is empty, do not retain it, but swap it for
Collections.emptyList(). Lowers memory overhead by not retaining an
empty ArrayList.

Change-Id: Ib2214613ebdbc394768b6db9543d2ef3504d1d53
Signed-off-by: Robert Varga <rovarga@cisco.com>
BUG-1270: be smart about Restrictions

Restrictions are based on type definitions, which are constant. For base
types they always are. For extended types, they are usually empty.
Optimize memory usage by reusing the lists anchored in types and also by
having a singleton instance for the all-empty case.

Change-Id: Ie9773d7efb57d403a008b82716eb22d97fefb224
Signed-off-by: Robert Varga <rovarga@cisco.com>
BUG-1270: reuse QNameModule

AugmentationSchemaBuilderImpl can reuse the QNameModule already exposed
from the Module, there is no need to instantiate a new, equivalent one.

Change-Id: I17bd5262e073baa27b089930702ed5780c10d79e
Signed-off-by: Robert Varga <rovarga@cisco.com>
BUG-1270: optimize SchemaPath creation

There is no need to instantiate temporary collections. Also
UnionTypeBuilder instantiated the same path over and over again. Fix all
the offenders.

Change-Id: Ie4ebe82dbc2902516459584c3386880c15fe063a
Signed-off-by: Robert Varga <rovarga@cisco.com>
BUG-1270: optimize SchemaPath creation for augmentations

As it turns out, at least in one case we can use
SchemaPath.createChild(), which is much more efficient than the
Iterable-based constructor. Drop a FIXME to investigate whether we can
reuse an existing SchemaPath in the other case.

Change-Id: I1aae1c9855490a21bcda7ffe17d52e081cc7de1d
Signed-off-by: Robert Varga <rovarga@cisco.com>