orta / cocoapods-keys

A key value store for storing per-developer environment and application keys
MIT License
1.55k stars 93 forks source link

Fix C inlining issues #202

Closed ashfurrow closed 4 years ago

ashfurrow commented 4 years ago

I've tested this with Artsy's codebase to make sure it still works 👍 It puts the data in an NSString, and uses characterAtIndex: Objective-C function calls, which are unlikely to be inlined by the compile. This might incur some performance penalty, but, that's probably fine.

I also made some refactors to use less Objective-C runtime stuff and make this easier to maintain. The downside of this approach is that it loads all keys upfront in init, which has potential further performance impacts. This now optimizes for creating fewer instances of the Keys object, since creating each one is more expensive but each key access is free.

The refactor is in a separate commit in case you'd like to keep the original implementation. I have verified both commits solve the problem of inlining keys in the binaries.

Fixes #201.

orta commented 4 years ago

CI fail is a dumb style linting thing - other than that, this looks and sounds good to m. Get it green and I'll ship a release 👍

ashfurrow commented 4 years ago

🍏

muddsar commented 4 years ago

Thanks @ashfurrow & @orta for quickly resolving this issue. It looks amazing

orta commented 4 years ago

Rockin'