]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
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)
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


No differences found