BigTable: Cell.from_pb() performance improvement#4745
BigTable: Cell.from_pb() performance improvement#4745tseaver merged 4 commits intogoogleapis:masterfrom
Conversation
|
A couple of questions:
|
|
@tseaver the code that a client uses to create a cell calls the following method on row.py: SetCell is a Mutation type and all changes to BigTable go through Mutations. At the Mutation level the timestamp is expressed in units of microseconds. So the Cell class is really a read only class - there is no ORM magic going on for the persistence. ;-) I hope this answers your first question above. As far as memoization, I thought of that, but suspect that the timestamp as a datetime type will be read once. |
|
Can this be merged now? |
|
LGTM |
|
@zakons Thanks for the patch! |
|
@tseaver Looks like something is wrong in the system tests. Looking into it. But feel free to find the mistake(s) if you see it first. |
|
@tseaver looks like I found the cause and it's not a big deal. I'll check again to make sure but I'll submit a PR for it. |
Change to have Cell store the microseconds from the Cell protobuf and to use a property annotation to get the timestamp as a datetime, when requested. This moves the performance penalty to only the code which needs to access this timestamp, which may actually be a small amount of code. There is better than a 5% performance improvement for reading rows with 10 cells. See Issue #4714.