-
Notifications
You must be signed in to change notification settings - Fork 10.7k
[cxx-interop] Add support for benchmarks with C++ interop. #32721
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| //===--- CreateObjects.swift ----------------------------------------------===// | ||
| // | ||
| // This source file is part of the Swift.org open source project | ||
| // | ||
| // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors | ||
| // Licensed under Apache License v2.0 with Runtime Library Exception | ||
| // | ||
| // See https://swift.org/LICENSE.txt for license information | ||
| // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| // This is a simple test that creates thousands of C++ objects and does nothing | ||
| // with them. | ||
|
|
||
| import TestsUtils | ||
| import CxxCreateObjects | ||
|
|
||
| public let CreateObjects = BenchmarkInfo( | ||
| name: "CreateObjects", | ||
| runFunction: run_CreateObjects, | ||
| tags: [.validation, .bridging]) | ||
|
|
||
| @inline(never) | ||
| public func run_CreateObjects(_ N: Int) { | ||
|
||
| for i in 0...(N * 10_000) { | ||
| let x = Int32(i) | ||
| let f = CxxLoadableIntWrapper(value: x) | ||
| blackHole(f) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| struct CxxLoadableIntWrapper { | ||
| int value; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| module CxxCreateObjects { | ||
| header "CreateObjects.h" | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.