Skip to content

Tweak Symbol and InternedString #60659

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 5 commits into from
May 10, 2019

Conversation

nnethercote
Copy link
Contributor

Some minor improvements to speed and code cleanliness.

r? @Zoxc

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 9, 2019
@nnethercote
Copy link
Contributor Author

@bors try

@bors
Copy link
Collaborator

bors commented May 9, 2019

⌛ Trying commit 3e5e8d3 with merge 9a6dab6...

bors added a commit that referenced this pull request May 9, 2019
…=<try>

Tweak `Symbol` and `InternedString`

Some minor improvements to speed and code cleanliness.

r? @Zoxc
@bors
Copy link
Collaborator

bors commented May 9, 2019

☀️ Try build successful - checks-travis
Build commit: 9a6dab6

@Zoxc
Copy link
Contributor

Zoxc commented May 9, 2019

@rust-timer build 9a6dab6

@rust-timer
Copy link
Collaborator

Success: Queued 9a6dab6 with parent 9f83961, comparison URL.

@petrochenkov petrochenkov self-assigned this May 9, 2019
@nnethercote
Copy link
Contributor Author

I got miniscule improvements locally, but I think it's worthwhile from the clean-up angle.

//
// FIXME: ensure that the interner outlives any thread which uses
// `LocalInternedString`, by creating a new thread right after constructing the
// interner.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Zoxc , I don't think this FIXME is necessary?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not?

Copy link
Contributor

@petrochenkov petrochenkov May 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed this is already true due to how GLOBALS and threads are created.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it happens do be done that way now, but it's not enforced or documented as required by symbol.rs.

@petrochenkov
Copy link
Contributor

Could you revert the fn get -> fn symbol_str/fn symbol_or_gensym_str change?
It's ideologically wrong and it's not faster since symbol_str is still doing checked indexing.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 9, 2019
@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 9a6dab6

This lets comparisons occur with a single access to the interner,
instead of two.
Lots of details I wish I'd known when I first looked at this code.
@nnethercote nnethercote force-pushed the tweak-Symbol-and-InternedString branch from 3e5e8d3 to e53bb1a Compare May 10, 2019 06:52
@nnethercote
Copy link
Contributor Author

@petrochenkov: New code is up.

@@ -367,10 +380,6 @@ impl Symbol {
with_interner(|interner| interner.intern(string))
}

pub fn interned(self) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this removed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer used.

@petrochenkov
Copy link
Contributor

r=me is @Zoxc doesn't have more concerns

r? @Zoxc

@petrochenkov petrochenkov removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 10, 2019
@petrochenkov petrochenkov added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 10, 2019
@Zoxc
Copy link
Contributor

Zoxc commented May 10, 2019

@bors r+

@bors
Copy link
Collaborator

bors commented May 10, 2019

📌 Commit e53bb1a has been approved by Zoxc

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 10, 2019
Centril added a commit to Centril/rust that referenced this pull request May 10, 2019
…edString, r=Zoxc

Tweak `Symbol` and `InternedString`

Some minor improvements to speed and code cleanliness.

r? @Zoxc
bors added a commit that referenced this pull request May 10, 2019
Rollup of 6 pull requests

Successful merges:

 - #60529 (RFC 2008: Uninhabitedness fixes for enum variants and tests)
 - #60620 (Fix a couple of FIXMEs in ext::tt::transcribe)
 - #60659 (Tweak `Symbol` and `InternedString`)
 - #60692 (Extend #60676 test for nested mut patterns.)
 - #60697 (add regression test for #60629)
 - #60701 (Update mailmap for mati865)

Failed merges:

r? @ghost
@bors bors merged commit e53bb1a into rust-lang:master May 10, 2019
@nnethercote nnethercote deleted the tweak-Symbol-and-InternedString branch May 12, 2019 22:40
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants