Skip to content

Conversation

@lnicola
Copy link
Member

@lnicola lnicola commented Jul 1, 2020

No description provided.

@lnicola
Copy link
Member Author

lnicola commented Jul 1, 2020

This helps less than expected, but still seems like a decent win:

image

And it's not visibly slower:

Database loaded 1.255206199s
Crates in this dir: 36
Total modules found: 489
Total declarations: 9541
Total functions: 7431
Item Collection: 18.003271618s, 0b allocated 0b resident
Total expressions: 194020                                                                                                                          
Expressions of unknown type: 1588 (0%)
Expressions of partially unknown type: 992 (0%)
Type mismatches: 452
Inference: 29.650529527s, 0b allocated 0b resident
Total: 47.653807827s, 0b allocated 0b resident

Database loaded 254.772917ms
Crates in this dir: 36
Total modules found: 489
Total declarations: 9541
Total functions: 7431
Item Collection: 17.795208032s, 0b allocated 0b resident
Total expressions: 194020                                                                                                                          
Expressions of unknown type: 1576 (0%)
Expressions of partially unknown type: 980 (0%)
Type mismatches: 452
Inference: 28.918111862s, 0b allocated 0b resident
Total: 46.713327311s, 0b allocated 0b resident

impl_: SemanticsImpl<'db>,
}

pub struct SemanticsImpl<'db> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it need to be pub?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure. It's now used in the ToDef trait and I changed that to take SemanticsImpl.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, right, than let's keep it pub for simplicity

node: &SyntaxNode,
offset: TextSize,
) -> Option<N> {
self.impl_.find_node_at_offset_with_descend(node, offset)
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's inline generic parts of impl_.find_node_at_offset_with_descend here, and leave only non-generic bit in SemanticsImpl here and elsewhere .

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that will turn the non-generic bits return impl Iterator<Item=SyntaxNode so that the generic ones can call find_map(N::cast) on them.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, returning, returning an impl Trait is OK, as that's still a specific type under the hood.

@lnicola lnicola changed the title Try to make reduce Semantics monomorphisations Try to reduce Semantics monomorphisations Jul 1, 2020
@lnicola
Copy link
Member Author

lnicola commented Jul 1, 2020

r? @matklad

@matklad
Copy link
Contributor

matklad commented Jul 1, 2020

bors d+

there's a bunch of .js changes somehow

@bors
Copy link
Contributor

bors bot commented Jul 1, 2020

✌️ lnicola can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@lnicola
Copy link
Member Author

lnicola commented Jul 1, 2020

Sorry, not sure what happened there.

bors r=matklad

@bors
Copy link
Contributor

bors bot commented Jul 1, 2020

✌️ matklad can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@lnicola
Copy link
Member Author

lnicola commented Jul 1, 2020

bors r=matklad

@bors
Copy link
Contributor

bors bot commented Jul 1, 2020

@bors bors bot merged commit 248b656 into rust-lang:master Jul 1, 2020
@lnicola lnicola deleted the mono-semantics branch July 1, 2020 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants