More Xcode 10 Performance Tests

September 24th, 2018

xcode.jpg

This morning I decided to take another look at the Xcode 10 performance tests on my CryptoQuip puzzle solver, but this time, looking at the Objective-C version and see if the Xcode 10 changes would make it any faster. Turns out, I'm very glad that I did.

I was getting a very odd error on the line:

int main(int argc, const char *argv[])
{
    return NSApplicationMain(argc, argv);
}

the value of argv was causing a SIGABRT - and I just had a feeling it was some setting in the old project file and I needed to clean those up - so after a little bit of updating, it compiled and ran just fine.

I then put in the timing of the call with a few lines:

- (BOOL) attemptWordBlockAttack
{
    // sort the puzzle pieces by the number of possible words they match
    [[self getPuzzlePieces] sortUsingSelector:@selector(comparePossibles:)];
    // ...now run through the standard block attack
    NSTimeInterval begin = [NSDate timeIntervalSinceReferenceDate];
    BOOL ans = [self doWordBlockAttackOnIndex:0 withLegend:[self getStartingLegend]];
    NSLog(@"%lu Solution(s) took %f msec",
        (unsigned long)[[self getSolutions] count],
        ([NSDate timeIntervalSinceReferenceDate] - begin) * 1000);
    return ans;
}

so that I'd get a similar result as the Swift version - basically, taking everything out of the time in the solution except the attack. That's as close as an apples-to-apples as I could get with the other versions.

What I found out blew me away:

CryptoQuip[87317:16056980] Loaded 25384 words from /Users/drbob/.../words
CryptoQuip[87317:16056980] Ready
CryptoQuip[87317:16056980] Solving puzzle: 'Fict O ncc bivteclnbklzn O lcpji ukl pt
                               vzglcddp' where b=t
CryptoQuip[87317:16056980] 1 Solution(s) took 0.464082 msec
CryptoQuip[87317:16056980] Solution found: 'When I see thunderstorms I reach for an
                               umbrella'

Now the times for Clojure were in the 6 msec... and Swift was about 7 msec... but I had to do a double-take on this... I had no idea Objective-C was going to be this fast! I had to compute, by hand, the number of milliseconds since the reference date - January 1, 2001 - just to make sure I was doing the math right. I was right... it was right... I checked the code several times, made sure I wasn't skipping the actual solution... and I wasn't.

Wow... Apple has really outdone themselves on this... sub-msec on the solution. Wow! I have to say this is excellent news in my book. I can live with Swift, and I know it's the future, and it's fast... but it's not this fast, and that's just amazingly cool!

Updated DKit to SO Shared Library

September 18th, 2018

DKit Laboratory

Withe the recent improvements in performance from Xcode 10 for my Swift code, I thought I wanted to dust off DKit and make sure it still works on macOS 10.13.6 with Xcode 10 - it's been quite a few years since I've made any changes to it, and I just wanted to make sure it all builds and runs.

One of the things I remembered from a few months ago, when I tried to dust it off for a homework project for a job interview and I had some problems with the fact that the shared library was being built as a dylib and that just makes it a lot harder. At the time I originally wrote the library - some 15 yrs ago - there wasn't the support in Mac OS X for the standard unix SO shared library - so I had to use the dylib and figure out how to link it in properly.

Today, the story is entirely different - and honestly, for several years, I've known that macOS could generate the unix SO shared library. So I just switched over to that this morning, and gave it a spin. Turns out it worked perfectly.

I was able to compile all the components of the library, and then the test apps, where the templates are really being used, and all the tests ran. I checked in the simple changes to the Makefiles and everything is solid.

I'm sure there are a lot of things that this could add - I could make a test app that read a file and sent it out on a TCP or UDP transmitter - for the testing of the TCP and UDP receiver, but I'm not worried about that right now. It's enough that it's still working just fine, and builds on the latest macOS. Can't beat that!

Xcode 10 Performance Tests

September 18th, 2018

xcode.jpg

This morning, with Xcode 10 updated yesterday with iOS 12, I thought I'd take a run at the Quipper code that is based on Swift 4.2. In the past tests on Xcode 9, I was seeing times in the 40 msec (Release build) and that was nice as it was fully 20 msec faster than ObjC on the same machine, but it's still a far cry from the 6 msec of Clojure on the same machine.

But I've heard a lot about the speed improvements in iOS 12, and it seemed like a smart thing to test the performance on the same code, on the same box - but with Xcode 10. So I did. Wow.

2018-09-18 06:59:04.76 Clearing out all old data for the attack...
2018-09-18 06:59:04.79 List of Possibles:
2018-09-18 06:59:04.79   ... bivteclnbklzn :: 1
2018-09-18 06:59:04.79   ... O :: 2
2018-09-18 06:59:04.79   ... ncc :: 29
2018-09-18 06:59:04.79   ... pt :: 40
2018-09-18 06:59:04.79   ... vzglcddp :: 46
2018-09-18 06:59:04.79   ... ukl :: 589
2018-09-18 06:59:04.79   ... Fict :: 1727
2018-09-18 06:59:04.79   ... lcpji :: 2168
2018-09-18 06:59:04.79 Starting the word block attack...
2018-09-18 06:59:04.79 working on word: 0 [bivteclnbklzn] - 1 possible matches
2018-09-18 06:59:04.80 working on word: 1 [O] - 2 possible matches
2018-09-18 06:59:04.80 working on word: 2 [ncc] - 29 possible matches
2018-09-18 06:59:04.80 working on word: 3 [pt] - 40 possible matches
2018-09-18 06:59:04.80 working on word: 4 [vzglcddp] - 46 possible matches
2018-09-18 06:59:04.80 working on word: 2 [ncc] - 29 possible matches
2018-09-18 06:59:04.80 working on word: 3 [pt] - 40 possible matches
2018-09-18 06:59:04.80 working on word: 4 [vzglcddp] - 46 possible matches
2018-09-18 06:59:04.80 working on word: 5 [ukl] - 589 possible matches
2018-09-18 06:59:04.80 working on word: 6 [Fict] - 1727 possible matches
2018-09-18 06:59:04.80 working on word: 7 [lcpji] - 2168 possible matches
2018-09-18 06:59:04.80 1 Solution(s) took 7.602294921875 msec

I was just shocked - 7.6 msec - that's within reasonable tolerance with the Clojure code - and all that improvement is in the compiler! I have to tip my hat to the Xcode engineers - that's an amazing improvement. I'm guessing that macOS Mojave is going to be quite a treat in a week, as it's been built with these tools. That's something very nice to look forward to.

For now, I'm super happy with the performance of Swift 4.2 - and while I'm not a huge fan of the syntax, it's got the performance that means it's something to take seriously, and use as opposed to Clojure which was problematic on the iOS and macOS apps anyway.

Great News!

There’s Something to be Said for Talent

September 17th, 2018

gitLogo_vert.gif

Linus Torvalds is in the news again this morning, and I'm glad to see he's now aware of the effect he had on people, it got me thinking about git and I thought I remembered that he wrote the first version of git after something happened with the license on the SCM tool he was using on the Linux Kernel. So I hit Wikipedia, and sure enough, there was a license issue with BitKeeper, and so Linus wrote the first version of git.

What I hadn't remembered was the timeline - and that's what amazed me this morning:

  • 3 April 2005 - Development Starts on git
  • 6 April 2005 - the git project is announced
  • 7 April 2005 - git is self-hosting
  • 18 April 2005 - first merge of multiple branches
  • 29 April 2005 - performance target is achieved: 6.7 patches per second
  • 16 June 2005 - linux kernel 2.6.12 release is managed by git

So a couple of months to get a SCM that hosts one of the most influential codebases that currently exists... that's more than impressive... that's down right amazing.

Think about all that git has effected... GitHub, BitBucket, GitLabs - there's an industry built up around it - that's wild to think about. Sure, the guy may not be someone you want to have over for dinner, but what he accomplished in a few months was nothing short of amazing. And all of us in the tech community have benefited from it.

There is something to be said for talent... it's not necessarily sitting in the prettiest of packages, but we would all do well to look past the packaging, and try to see the real value under the covers. It can be revolutionary.

iOS 12 Drops Today!

September 17th, 2018

IPhoneX

We are entering a very exciting week for Apple folks, such as myself. Today it's iOS 12 with the Memoji, automation with Siri, more efficient code to make a lot of things faster on older hardware, and soon - multi-person FaceTime. That last one is interesting to me as it really challenges Google Hangouts and GoToMeeting. They are good products, but this will be in all iPhones, and that's got a really big advantage in market-share.

I also read the comparison of the iPhone Xs Max with the 13" MacBook Pro - and the iPhone was certainly on par with the laptop... it's just crazy how much capability Apple is packing into these phones... I think I need to do a little looking into ARKit and see what it's got. I'm not really sure that I have an augmented reality idea in me, but it might be really nice to see how to do these things. You just never know.

Exciting week!

New iPhones!

September 12th, 2018

IPhoneX

Well... Apple's concluded it's Watch/iPhone event, and I have to say, the rumors were not wrong, and it's still interesting and exciting to see the new iPhones and Watches. Some of the things they are doing on the Watch now is just amazing. ECG on the Watch - one finger on the crown and then the watch's sensors. Crazy.

The new iPhone Xs sounds amazing... faster Face ID - which I use all the time, and the specs on the CoreML engine - 9x the performance on 1/10th the power... 6 cores on the A12... it's just amazing what Apple - Apple is doing on these machines. It's a company that just always makes me smile.

Needless to say, at 2:00 am on Friday, I'll be sitting at my computer and ordering my iPhone Xs and it'll ship a week later. Add in that iOS 12 drops next Monday, and macOS Mojave on the Monday after that, and it's just a big banner September for Apple.

What a company!

Some Recent Books

September 11th, 2018

Books and Stuff

I've just finished a book that I really enjoyed, but I'm glad I read it last of the three - in fact, I'm glad I read each of them in the order in which I did. It made for a much smoother reading experience - because I started with Pragmatic Scala and this was really based on the fact that we are using Scala in The Shop, and as such, I felt it was important to get up to speed on the language, and the Pragmatic Books have always been pretty good, in my experience.

Well, this was a fine book on Scala, but I have to say, I'm stunned that Scala is as popular as it is. I understand that one of the key design goals of the language was to be a pure Object Oriented language - and as such things like static methods and variables are not allowed in the instance variables, but they solve that with partner classes, and that's OK... but it is confusing for many folks - simply because most coders are not going to have a Theory of Languages in their past.

Still... Scala is a language we use at The Shop, and that means for better or worse, this is something that I needed to know. The next book was a little more fun because it was all about Xcode. In Xcode Treasures, the author walks through the tool not the SDK. This is nice, because in my recent work, I've re-written my crypto quip solver to Swift 4.2, in Xcode 9, and the times are really not horrible - compared to ObjC and Ruby, but Clojure still wins the speed race, but that's to be expected.

And while I spent plenty of time in Xcode quite a while ago, it's nice to see how much progress has been made in Xcode recently. The handling of assets like icons and images, and being able to load them without worrying about the resolution is really nice. Also, the entire Gatekeeper and Code Signing is now simple, and it used to be a pain. That's a great relief.

So this was a really good chance to catch up on a lot of the capabilities with Storyboards in Xcode and the scripting and such... very nice book. The final book was Mastering Clojure Macros and this is one I've been trying to get through for quite a while - many months, in fact. It's not a long book, but it's dense, and it takes time to make sure you understand the concepts because macros in Clojure are hard enough, and some of the examples are compact - as Clojure is want to do, and that just makes it all that much harder.

But the book was just amazing! What a great study of the subject. This was one of the few topics I really wanted to get better at with Clojure. Yes, I'd like to get a little more into spec, and core.async could be very useful if you're making small, independent apps, as opposed to big, multi-host apps where you typically share messaging queues, etc., but still... macros are in everything when you really get into things and I have been able to do quite a bit with them to date, but I wanted to know more.

Of the three - they are all worth reading - if you want to learn the material, but I really enjoyed the last two far more than the Scala book, but that's because of the subject - not the book.

Letting Go… Moving On…

September 10th, 2018

Path

Yesterday I decided that it was time to accept that my attempts at being present for my two youngest kids by texting them every Sunday morning - just to say "Hi!" and wish them a good week, wasn't what I would have liked from my Dad at the time, and they hadn't written back in more than a year, and at the time it was not kind. They need space. If they never reach out to me, it's not because I haven't made it clear that I'm here... it's a conscience, willful choice to not reach out - and they deserve to make those decisions, no matter how it impacts me.

So I wrote them one last time - telling them that if they wanted me to continue - just say so, and I will... but if not, I understand, and I'll be here, if they ever change their mind. I thought it was a pretty good way to put it.

I don't think I'll hear from them except when they want money for college, and then the first time after college they ask - like grad school, or rent, or vacation, or something - and I say "No" - that will be it. Their choice - not mine.

At the same time, I said the same thing to a friend that I used to work with, but hasn't written back in more than three months. I don't want to appear to be a pest, so again... if they want to chat - I'm here... but getting weekly updates from me is something else, and it's OK... people change, things happen, jobs change, and so it goes. That's fine.

In short, I'm deciding that it's OK for people to change. Pick different likes and dislikes, and even if I'm one of the dislikes, that's just the way life is sometimes, and I'll have to be OK with that - family or not.

Moving on. I need to get on with it.

Stan Against Evil – Really Good Show

September 8th, 2018

TV.jpg

I happened to fall into a funny show on Hulu recently - Stan Against Evil. And it's really good. The premise is a completely over-the-top older sheriff's wife dies, and he goes a little off the deep end, and has to be replaced by a much younger, woman, sheriff. He of course, has no time, respect, tolerance, or interest in this new sheriff, and keeps acting like he's the sheriff.

The wrinkle to this is that his late wife was really protecting him from all kinds of supernatural threats that have been cursed on the sheriffs of this town for the last 400 years. He knew nothing about this, of course, and that his wife even had anything outside the home - let alone protecting him against evil is just too much for him, in the beginning.

Then he realizes what's happening around him - basically, that he's no longer protected, and he has to defend himself - and the new sheriff, as she is cursed for the same reason as he was - being sheriff of this town.

So I stumbled onto this show on Hulu, and watched the first two seasons there, as the new third season is starting soon on IFC. It's silly. It's over the top. It's just fun, and there isn't enough of that these days...

When Adults aren’t Really Adults

August 7th, 2018

cubeLifeView.gif

I just had a conversation with a co-worker, a good guy with all the best of intentions, and a solid core of wanting to help people. In the past, I've been a little taken aback by some of the things he's advised me to do - most notably, to have patience with this organization, and to accept that it'll be a year or so before people really start to listen to me.

He is not alone. I've heard that many times from several very senior people, and it still makes me giggle... as if the hiring process were somehow just a game, and the real vetting of people comes after they are hired. I still giggle...

But today it's about people being adults and the problem of putting a bunch of folks into a group and expecting them to play nice with one another. Most frustrating to me today is that you can't expect them to act like adults much of the time. Forget acting professional - I'm just asking that when someone is nice, polite, patient - that it would be really nice to have the person... I don't know... answer you?

I know this isn't unique to any one organization. Dilbert is filled with examples of this every week and we all laugh at the antics there... but it really happens, and it really is a chore to be doing a job you don't necessarily enjoy, and being polite, kind, patient - just doesn't seem to work.

I'm old enough to know that this has nothing to do with me, or this line of work, or the specific people involved. I've seen it at almost every place I've ever worked. Some are more up-front about it than others, but they all suffer from it. It's people. It's just people. Sadly, it's a frustration that I know has no outlet. It's just something that has to be accepted with a quiet shake of the head, and then let it go.

People don't change because they see a better way. They don't change because someone asks them. No... they change because they want to - simple as that. There may be a million reasons why - but they have to choose it, and nothing I can possibly do - other than what I've already done, is going to change that. It's their path, and they have to take the steps and learn what they have to learn.

And I do too.