dumbledad
dumbledad

Reputation: 17527

Diagnosing iOS C++ / Objective C++ calls from Swift in Xcode

I have some legacy C++ that I call using an Objective C++ bridge from a Swift iOS app.

I first built a simple test app (basically just the C++ call with limited UX around it). In this test app the C++ takes between 0.4 and 1.4 seconds to complete, as measured naively using this pattern:

let startedAt:NSDate = NSDate()
self.callOutToCPlusPlus(loads:of, passedIn:values)
print("CPlusPlus done in \(NSDate().timeIntervalSinceDate(startedAt)) seconds")

Now I have added the same code used in the test app to the full app where it takes 3.5 seconds. How do I diagnose the slow down?

Upvotes: 0

Views: 101

Answers (1)

Anatoli P
Anatoli P

Reputation: 4891

A few ideas:

1) Is the legacy code built as part of the Xcode project? If so, you may be able to use Xcode's profiling capabilities to see where the slowdown is. 2) Do you use the same optimization level in your test and full apps? 3) Do you pass the same data to the legacy code in both apps?

Hopefully this helps.

Upvotes: 1

Related Questions