Skip to content

[interop] cxx vector benchmark - reenable without SwiftPM support #61565

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
merged 2 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions benchmark/cxx-source/CxxVectorSum.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,16 @@

import TestsUtils

public let benchmarks: [BenchmarkInfo] = []
#if FIX_61472
#if SWIFT_PACKAGE
// FIXME: Needs fix for https://github.com/apple/swift/issues/61547.

import std
public let benchmarks = [BenchmarkInfo]()

// FIXME: remove workaround for: https://github.com/apple/swift/issues/61472
public func __workaround_std_import() {
let s = std.string()
blackHole(s.size())
}
#else

import CxxStdlibPerformance
import Cxx

// FIXME: Linux needs fix for https://github.com/apple/swift/issues/61547.
#if os(Linux)
public let benchmarks: [BenchmarkInfo] = []
#else
public let benchmarks = [
BenchmarkInfo(
name: "CxxVecU32.sum.Cxx.rangedForLoop",
Expand Down Expand Up @@ -139,4 +131,3 @@ extension VectorOfU32.const_iterator : Equatable, UnsafeCxxInputIterator { }

extension VectorOfU32: CxxSequence {}
#endif
#endif
5 changes: 3 additions & 2 deletions benchmark/scripts/Benchmark_Driver
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,9 @@ class MarkdownReportHandler(logging.StreamHandler):
msg = self.format(record)
stream = self.stream
try:
if isinstance(msg, str) and getattr(stream, "encoding", None):
stream.write(msg.encode(stream.encoding))
if isinstance(msg, str) and (getattr(stream, "encoding", None) and
getattr(stream, "buffer", None)):
stream.buffer.write(msg.encode(stream.encoding))
else:
stream.write(msg)
except UnicodeError:
Expand Down