Alberto
Alberto

Reputation: 4282

String parser for Swift?

I'm working on a project that draws functions on a plane (Similar to Apple's Grapher utility).

I'have already compiled this app few months ago in Obj-C, and was running clean and fast.

With Swift, I changed a bit the scheme of the app, but I'm still using CGMathParser, a great collection of classes to manipulate and evaluate strings like y=sin(x) or y=log(tan(x))

However the app is now slow and laggy, and I'm thinking that the reason hides in the fact that I'm mixing Swift with Obj-C.

Do you know if there is any kind of parser already optimized for Swift that will be fast enough?

Upvotes: 0

Views: 788

Answers (1)

ColinE
ColinE

Reputation: 70142

The Swift compiler enforces bounds checks and various other 'safety' features. If you compile with the -Ofast option these checks are removed, which typically makes your app run a lot faster.

enter image description here

Upvotes: 2

Related Questions