Adar Dembo has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/14604 )
Change subject: [util] Fix comment of faststring ...................................................................... [util] Fix comment of faststring 1. Under any case, capacity() is greater than or equal to the data length. If the current length is shorter than kInitialCapacity, after call shrink_to_fit(), capacity() will go down to kInitialCapacity. 2. The caller must be responsible for releasing the pointer release() returns. Now In `GrowByAtLeast()`, to_reserve (i.e. `len_ + count`) is usually larger than we really need. This commit also calculate an exact value when we try to expand the faststring. To be clearer, this commit rename `GrowByAtLeast()` to `GrowToAtLeast()`, and make the newcapacity as its argument. Note: If the capacity needs to grow, it still expand by at least 50% each time. Change-Id: Ie4bd4f31216fdf5cfbf70526f1358824fbda225a Reviewed-on: http://gerrit.cloudera.org:8080/14604 Reviewed-by: Adar Dembo <[email protected]> Tested-by: Adar Dembo <[email protected]> --- M src/kudu/util/faststring-test.cc M src/kudu/util/faststring.cc M src/kudu/util/faststring.h 3 files changed, 76 insertions(+), 13 deletions(-) Approvals: Adar Dembo: Looks good to me, approved; Verified -- To view, visit http://gerrit.cloudera.org:8080/14604 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: Ie4bd4f31216fdf5cfbf70526f1358824fbda225a Gerrit-Change-Number: 14604 Gerrit-PatchSet: 6 Gerrit-Owner: Anonymous Coward <[email protected]> Gerrit-Reviewer: Adar Dembo <[email protected]> Gerrit-Reviewer: Anonymous Coward <[email protected]>
