@gregtitus beautiful! Can you get rid of the if statements inside the cases in insertValue() by using case…where?
-
-
- View other replies
-
@curtclifton Yes. Much prettier, thanks for the suggestion: https://gist.github.com/anonymous/931f4cc7fc60fc8396a6 … -
@gregtitus sweet! Would it make sense to nest the def of TrieNode inside Trie class? Guess we don't really know the plan for encapsulation. -
@curtclifton Maybe? I was thinking of Trie class being old way (pointer to mutable thing) and accessing TrieNode as new (immutable struct). -
@curtclifton Seemed like different clients might like different looks, but it's hard to know yet.
-
-
-
Now I have to figure out how to make Swift code fast. Fumbling around in a dark room feeling for light switches… But when you find them!
-
@gregtitus I wouldn't focus on trying to optimize right now. If you find slow things, file 'em and let the swift optimizer folks have a shot -
@catfish_man I don't expect Swift to be fast right now, but getting a feel for what idioms are performant and what aren't is good learning. -
@gregtitus yup, just be aware of when something is being skewed by a bug. Inner loop is 90% refcounting? Probably a bug not a slow pattern. -
@catfish_man Yup, but who will appreciate the bug fixes without ppl like me. :) (protocol witnesses appears to be the slow bit atm, btw) -
@gregtitus aye :) in the same boat here. I have a couple of test cases I run every time I install a new Xcode build.
-
-
-
@gregtitus@siracusa that’s a property, but it’s type is an extension? How can extension be a type of an expression as different from String - View other replies
-
-
-
-
-
@gregtitus is there a memory and perf comparison? -
@evanlong Mem within 10%, perf is about 2x slower in Swift (compiled fastest/unchecked). Room to improve, but I'm happy with Swift so far. -
@gregtitus Ahhh, good on mem. I saw the branching with dictionaries and was a red flag at first. -
@evanlong Dicts were slow, that perf was on a later version that has a couple more optimizations:https://twitter.com/gregtitus/status/476111810349641728 …
-
-
-
@gregtitus Maybe fewer lines of code is not a goal? Swift can promote unreadable code. The language is for the human, not the computer. -
@eweu I mostly disagree. It's possible to be too terse, certainly, but there are zero bugs in the lines of code you don't write. -
@gregtitus True but think about the obvious bug on one line vs. the subtle bug buried in some anonymous function on a one line zinger. -
@eweu I don't think that applies to the code snippet you are replying to, personally. Very straightforward, nothing tricky.
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Greg Titus
Curt Clifton
David Smith
Michael Gorbach
evanlong
Matthew S