You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or 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
This PR alters the Sequence.first(where:) function to remove the use of a thrown error for flow control. When called under Xcode with the "Swift Error Breakpoint" (swift_willThrow) active, it will cause the debugger to stop wherever this API is used, even in a success state.
tonyarnold
changed the title
Don’t use an error for flow control in Sequence.first(where:)
stdlib: don’t use an error for flow control in Sequence.first(where:)
Jun 21, 2018
tonyarnold
changed the title
stdlib: don’t use an error for flow control in Sequence.first(where:)
[stdlib] Don’t use an error for flow control in Sequence.first(where:)
Jun 21, 2018
Model Name: Mac Pro
Model Identifier: MacPro6,1
Processor Name: 12-Core Intel Xeon E5
Processor Speed: 2.7 GHz
Number of Processors: 1
Total Number of Cores: 12
L2 Cache (per Core): 256 KB
L3 Cache: 30 MB
Memory: 64 GB
No benchmarks use first(where:) afaict :) Some stdlib implementations will, but they're inlined to heck so you probably wouldn't see a difference anyway.
I'm going to merge this. We should figure out a realistic benchmark that might push the performance case for the original form, add that, then revert this change and see if it makes any difference. We can always put the old implementation back if it does.
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.
This PR alters the
Sequence.first(where:)
function to remove the use of a thrown error for flow control. When called under Xcode with the "Swift Error Breakpoint" (swift_willThrow) active, it will cause the debugger to stop wherever this API is used, even in a success state.Further (amusing) discussion here on Twitter: https://twitter.com/tonyarnold/status/1007510236372979712
Resolves SR-3166.