Observations, stories, projects, photos.
In English and Russian.

Later Ctrl + ↑

Swift single-file compilation

There comes a time during the life of your Swift project when the compile times just don’t cut it. There are some tweaks and knob twirling you can do to improve them, but honestly, it doesn’t make that much of a difference.

I started looking around and found the deck “Swift compile time is so slow” by Masato Oshima where he claims that concatenating all the files together improved his build time sevenfold, from 6 minutes 55 seconds to a bit under a minute. “Impressive!” I thought and decided to test this approach for our project.

Now, concatenating all files to help the compiler out is not a new method, I know for certain that some game developers use it for C++ and the results are no less staggering, so this is a legitimate thing to try.

Let’s get to the test results. At the time of writing our project is about 40k lines of Swift code and a dozen of external frameworks. I used the slightly modified concatenate_swift_files.sh from keychain-swift, their version disposed of the newlines we used in some of our strings so I had to edit the script to handle that. Otherwise, no changes.

The time is from tapping on Run in Xcode to the Simulator appearing.

Concatenated files: 2 minutes 8 seconds.
Normal source files (around 300 of them): 2 minutes 32 seconds.

Result: a measly 16% improvement. Not worth pursuing for our project. On top of that, the logger we use (XCGLogger) showed all debug prints originating in the concatenated file (versus a specific source file), which is logical and expected, but annoying and unhelpful.

 No comments   2015   iOS   Swift

YKProgressBar

Another small piece of software I’m sharing with you. This time it’s an actual visible control!

YKProgressBar is a simple drop-in progress bar control with rounded edges all-around (ha-ha). Just copy the files YKProgressBar.[hm] into your project and you’re good to go.

Here’s a demo of YKProgressBar. The floating things on top are scrolled collection view cards.

If you’ve missed the link in the beginning, it’s up on GitHub.

 No comments   2015   iOS

“Life Is Short And So Is This Book” by Peter Atkins

This is a nice little book expressing the age-old truths in a concise and accessible way. Some reviewers on Amazon say that the book is shallow and the author just regurgitates on plain truths. But aren’t people simple creatures? The behavior that brings happiness won’t change, no matter how many times it’s repeated.

Here’s the freely available table of contents, which is also the list of things you should (or shouldn’t) do to fulfill your potential:

  1. Create space.
  2. Try not to worry.
  3. Don’t do really dumb things.
  4. Build character and make friends.
  5. Care for yourself and others.
  6. Laugh.
  7. Do what you love.
  8. Embrace change.
  9. Learn from experience.
  10. Have dreams and work towards them.

To put it even more tersely, it’s “be calm, be kind and be curious about the future.” Seems a lot like what Buddhism is all about, isn’t it?

There’s another similar book, also by a CEO, the founder of Panasonic Konosuke Matsushita, which is called “Principles of Success.” It’s an even shorter book and even more terse, compressing everything into three groups: management, work and life. All or most of what Peter Atkins offers is in Matsushita’s book, and vice versa. They may be plain truths, yet simple principles are easier to remember and easier to act on, than a bunch of convoluted tactics which won’t fit everyone.

Throughout the book, Atkins shares some brilliantly formulated principles, that I have been thinking about myself but haven’t been able to articulate.

Overall, it’s a treat to read and I’ll be sure to come back to this book.

Life is Short And So Is This Book” on Amazon.

 No comments   2015   Books
Earlier Ctrl + ↓