chore(Spanner): Make createTransactionSelector faster
This PR simply replaces the use of decodeMessage from the Serializer and uses the mergeFromJsonString and the protobuf class's setter method.
The metrics on average are:
Using decodeMessage
When createTransactionSelector is called the first time: 900 us(micros)
When createTransactionSelector is called the second time: 300 us (This is low because the Serializer caches a lot of things like proto descriptors etc).
Using mergeFromJsonString
When createTransactionSelector is called the first time: 200 us(micros)
When createTransactionSelector is called the second time: 150 us
Seems like protobuf's mergeFromString doesn't work with the following:
{"begin": {"readWrite": []}} whereas it works with: {"begin": {"readWrite": {}}}.
For now, closing this PR.
Seems like protobuf's mergeFromString doesn't work with the following: {"begin": {"readWrite": []}} whereas it works with: {"begin": {"readWrite": {}}}.
I have made sure that the JSON string uses {} for empty arrays by providing the JSON_FORCE_OBJECT flag, but the emulator tests are still failing. This will require further investigation.