Improved Bindings.getBinding(Class) caching for Datatype.class 10/2010/2
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 17 Aug 2018 08:23:20 +0000 (11:23 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 17 Aug 2018 08:24:01 +0000 (08:24 +0000)
commita1696e5257fae039410c924155fdeffc1ce1b3e9
tree51c94cb394844c3271160d0eae5d7ec244baf644
parent286183f3501ea34badb28d05bd8de954eff9b8bc
Improved Bindings.getBinding(Class) caching for Datatype.class

Previously Datatype.class binding was never cached nor statically
constructed and made available as Bindings.DATATYPE which is only
sensible because Datatype class is a central building block of Databoard
and therefore its binding should also be readily available instead of
all clients having to request for it separately.

A weak hashmap cache was also added for signature strings in
BindingRequest because it was noticed that in conditions where code
makes a lot of requests for uncached binding, the cost of String
construction in BindingRequest.getSignature starts to dominate
cpu/memory costs. Two main problems in there were: constantly creating
new strings and using the very inefficient String.replaceAll instead of
String.replace(char, char).

gitlab #82

Change-Id: I50fbbc2bbe1e5d6b8b5864c3aed4c228022e66dc
bundles/org.simantics.databoard/src/org/simantics/databoard/Bindings.java
bundles/org.simantics.databoard/src/org/simantics/databoard/Databoard.java
bundles/org.simantics.databoard/src/org/simantics/databoard/binding/VariantBinding.java
bundles/org.simantics.databoard/src/org/simantics/databoard/binding/factory/BindingRepository.java
bundles/org.simantics.databoard/src/org/simantics/databoard/binding/reflection/BindingRequest.java
bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/PropertyInfo.java