]> gerrit.simantics Code Review - simantics/platform.git/commit
Improved Bindings.getBinding(Class) caching for Datatype.class
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 17 Aug 2018 08:23:20 +0000 (11:23 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Sat, 1 Sep 2018 08:22:43 +0000 (11:22 +0300)
commit7f06602810734e5a918be5e0ed542be3c1239c4f
treeabdb70021d3722dcca01ffb0a898c2d9585af2cb
parent2483fab15ce9bc84136c7ad488c0b1d9db801f6f
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
(cherry picked from commit a1696e5257fae039410c924155fdeffc1ce1b3e9)
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