Skip to content

[Stdlib] Add a test for the performance of CollectionType.first #860

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

Merged

Conversation

lilyball
Copy link
Contributor

@lilyball lilyball commented Jan 3, 2016

This tests the optimization commited in #825.

@@ -202,5 +202,41 @@ func testIsEmptyFirstLast() {
}
testIsEmptyFirstLast()

/// A `CollectionType` that vends just the default implementations for
/// `CollectionType` methods.
struct CollectionOnly<T: CollectionType> : CollectionType {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is Defaulted${traversal}Collection.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it.

@lilyball lilyball force-pushed the test-collectiontype-lazy-first-perf branch from 531b95c to 8cdaf4a Compare January 3, 2016 23:41
@lilyball
Copy link
Contributor Author

lilyball commented Jan 3, 2016

PR updated to use StdlibUnittest. In the end I couldn't use Defaulted${traversal}Collection because that doesn't take a collection type to wrap, and I couldn't use LoggingCollection because I needed to test how many times the filter predicate was called rather than how many times various CollectionType methods/properties were called.

// RUN: %target-run-simple-swift --stdlib-unittest-in-process | tee %t.txt
// RUN: FileCheck %s < %t.txt
// note: remove the --stdlib-unittest-in-process once all the FileCheck tests
// have been converted to StdlibUnittest
Copy link
Contributor Author

Choose a reason for hiding this comment

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

--stdlib-unittest-in-process is done because otherwise it repeats all of the non-StdlibUnittest tests in the child process, which causes duplicate output.

@gribozavr
Copy link
Contributor

I see. Thank you!

gribozavr added a commit that referenced this pull request Jan 4, 2016
…perf

[Stdlib] Add a test for the performance of CollectionType.first
@gribozavr gribozavr merged commit 1f2c865 into swiftlang:master Jan 4, 2016
@lilyball lilyball deleted the test-collectiontype-lazy-first-perf branch January 4, 2016 18:29
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.

3 participants