-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support string_view
initialization and lookup in TfToken
#3053
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nvmkuruc
force-pushed
the
tftokenstringview
branch
from
April 24, 2024 19:09
fabc40d
to
717d6f3
Compare
2 tasks
gitamohr
reviewed
Apr 25, 2024
gitamohr
reviewed
Apr 25, 2024
gitamohr
reviewed
Apr 25, 2024
gitamohr
reviewed
Apr 25, 2024
gitamohr
reviewed
Apr 25, 2024
Filed as internal issue #USD-9588 |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
nvmkuruc
force-pushed
the
tftokenstringview
branch
2 times, most recently
from
April 25, 2024 20:48
9993e62
to
324415e
Compare
nvmkuruc
force-pushed
the
tftokenstringview
branch
from
May 20, 2024 19:44
324415e
to
92b130b
Compare
nvmkuruc
force-pushed
the
tftokenstringview
branch
from
June 10, 2024 18:01
92b130b
to
6e43ed5
Compare
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
nvmkuruc
force-pushed
the
tftokenstringview
branch
from
June 11, 2024 18:47
6e43ed5
to
0b97e83
Compare
nvmkuruc
force-pushed
the
tftokenstringview
branch
from
August 26, 2024 18:45
0b97e83
to
dbd4d66
Compare
nvmkuruc
force-pushed
the
tftokenstringview
branch
from
September 18, 2024 19:08
dbd4d66
to
0a23b26
Compare
Closing this PR out because this change causes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change(s)
TfToken
is designed to optimize storage and comparison of commonly used strings like property names, values, and other path components. It currently provides two constructors, one for NULL-terminated C-strings and the other forstd::string
.There are cases where a token may need to be constructed from a part of a
std::string
. This often necessitates an intermediate heap-allocated copy when no allocation or copy is needed at all if the token already exists in the registry. The path parser currently optimizes this case by introducing a stack allocatedchar[32]
and copying and NULL-terminating strings short enough to fit in the buffer. However, this has not been generalized outside of the path parser, is limited to short strings, and still requires a copy.This change introduces a
std::string_view
constructor and associated utilities. It benefits the current implementation by unifying the C-string andstd::string
code paths, avoiding templating and specialization.It also replaces
Find(std::string const&)
with the more generalFind(std::string_view)
.A note is left in the
TfToken::_Rep
class about using a set that supports transparent hashing. This would allow lookups to transparently comparestd::string_view
against aTfToken::_Rep
without_Rep
storing an extrastd::string_view
field.Fixes Issue(s)