Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Make Queue.Peek inline#12062

Merged
stephentoub merged 2 commits into
dotnet:masterfrom
jamesqo:peek-inl
Sep 27, 2016
Merged

Make Queue.Peek inline#12062
stephentoub merged 2 commits into
dotnet:masterfrom
jamesqo:peek-inl

Conversation

@jamesqo
Copy link
Copy Markdown
Contributor

@jamesqo jamesqo commented Sep 26, 2016

We can trivially make Queue.Peek inline by moving the throw code into a new method. JIT will not inline this as per dotnet/coreclr#6103.

Test code, before/after asm

@ianhays

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Dequeue can call this as well, right? If nothing else it'd avoid duplicate usage of InvalidOperation_EmptyQueue. Not enough of a reason to separate it out into its own function, but as long as it is being separated out, might as well do so.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point, I forgot Dequeue does this as well. Have updated.

@karelz karelz added area-System.Collections enhancement Product code improvement that does NOT require public API changes/additions labels Sep 26, 2016
@ianhays
Copy link
Copy Markdown
Contributor

ianhays commented Sep 26, 2016

LGTM.

@jamesqo
Copy link
Copy Markdown
Contributor Author

jamesqo commented Sep 26, 2016

Test Innerloop Windows_NT Debug Build and Test

@stephentoub
Copy link
Copy Markdown
Member

Thanks.

@stephentoub stephentoub merged commit 2d0e2ab into dotnet:master Sep 27, 2016
@jamesqo jamesqo deleted the peek-inl branch September 27, 2016 01:07
@karelz karelz modified the milestone: 1.2.0 Dec 3, 2016
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Collections enhancement Product code improvement that does NOT require public API changes/additions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants