Better HN
topnewbestaskshowjobs
Log inSign up

lyinsteve

283 karma · joined Nov 14, 2013 (13y ago) · 61 submissions

Submissions

comment 2y ago · link · parent

The Swift optimizer has matured dramatically since 2017, to the point where I think this benchmark would almost certainly not result in a 3x power usage/4x slowdown compared to C.

On the current benchmark game, many of the purely algorithmic benchmarks are close to C performance, but many of these benchmarks seem to be stale and haven't been touched in quite a while. It would be nice if someone went through and rewrote these using current idiomatic Swift (where many of the "use unsafe bits for speed" tricks are unnecessary) and see how it really stacks up.

comment 8y ago · link · parent

I don’t know much about rust specifically, but the overflow traps happen in debug (i.e. -O0) builds, and are not emitted when optimizations are enabled.

LLVM’s constant folding and canonicalization passes will convert (x * 2) / 2 from

%0 = mul i64 %x, i64 2

%1 = div i64 %0, i64 2

to

%0 = shl i64 %x, i64 1

%1 = shr i64 %0, i64 1

Which constant folding will reduce to just %x.

comment 9y ago · link · parent

There are tons of amazingly-smart people working on Swift at Apple right now

comment 9y ago · link · parent

-swift-version 3 really just turns on some different paths through the parser and type checker to allow previously-valid Swift 3 code to survive to code generation time.

They're both compatible

comment 9y ago · link · parent

I have the strange feeling this will really only be used to enforce the copyrights of large music and movie industry corporations and will not be effective at protecting the IP of independent creators.

6.

Building a Compiler in Swift with LLVM, Part 3 of 4: Code Generation to LLVM IR(harlanhaskins.com ↗)

2 points · by lyinsteve · 9y ago · discuss

7.

Building a Compiler in Swift with LLVM, Part 1 of 4: Introduction and the Lexer(harlanhaskins.com ↗)

3 points · by lyinsteve · 9y ago · discuss

comment 9y ago · link · parent

This should be much higher. Thanks!

9.

Trill: A typed, LLVM-backed compiler, inspired by (and written in) Swift(github.com ↗)

7 points · by lyinsteve · 10y ago · discuss

10.

Trill: A typed, LLVM-backed compiler, inspired by (and written in) Swift(github.com ↗)

4 points · by lyinsteve · 10y ago · discuss

11.

Goto in Swift(harlanhaskins.com ↗)

1 points · by lyinsteve · 10y ago · discuss

comment 10y ago · link · parent

The author completely missed the point of named parameters. How am I supposed to know that the string argument of "make_window" is the title?

comment 10y ago · link · parent

Why did I just implement this in Swift? https://github.com/harlanhaskins/Base65536.swift

comment 11y ago · link · parent

Apple uses XMPP internally as a way to securely communicate.

Doesn't really change much; just thought that'd be an interesting thing to throw out.

15.

Show HN: Implementing a Lispy Language in Haskell: Part 1(harlanhaskins.com ↗)

6 points · by lyinsteve · 11y ago · discuss

comment 11y ago · link · parent

I'm a Computer Science House member -- Drink is still a staple of our organization! Where else can you get Jolt on campus?

Also we've since made an awesome web app and iOS app for dropping drinks.

17.

QuoteMaker – A Markov Chain Generator Generator(quotemaker.co ↗)

1 points · by lyinsteve · 11y ago · discuss

comment 11y ago · link · parent

Surprisingly salient and cogent points for an article that's so hostile and willfully ignorant.

The author is correct about when to use both, and I'm glad he doesn't discount structs entirely like I've seen from some OOP strongholds.

"The way they write functional programs for decidedly non-functional problems is through a trick called a monad, which I will not explain and nobody understands anyway,"

Maybe you'd be less hostile if you actually took the time to learn about generic abstractions and how they can greatly simplify a codebase.

Hint: Optional is a monad, and you can use it as such.

19.

Swift and Haskell: 'do' or Die(harlanhaskins.com ↗)

1 points · by lyinsteve · 11y ago · discuss

comment 11y ago · link · parent

>The move fast and break things approach

Sounds like something I want no part in.

comment 11y ago · link · parent

LLVM has a GitHub mirror, too.

https://github.com/llvm-mirror/llvm

comment 11y ago · link · parent

Why no mention of GCD here? GCD is very, very good at synchronizing access to shared resources.

The most Cocoa-compatible way of handling background execution of expensive procedures is always going to be best executed, quickest, using Grand Central Dispatch.

For example:

    @interface Foo ()
    @property (nonatomic) dispatch_queue_t backgroundQueue;
    @end
    
    @implementation Foo

    - (BOOL) veryExpensiveMethod:(id)arg completion:(void (^)())completion {
        dispatch_async(self.backgroundQueue, ^{
            if (_counter++ > N) {
                _counter--;
                return NO;
            }
            // Critical section
            _counter--;
            return YES;
            dispatch_async(dispatch_get_main_queue(), completion);
        };
That will ensure every call to -veryExpensiveMethod is run in sequence, and won't require waiting on your end.

These problems have been solved, better.

comment 11y ago · link · parent

>50. Give Steve Jobs as much authority as he wants in new product development.

24.

Computer Science House(csh.rit.edu ↗)

2 points · by lyinsteve · 11y ago · 1 comment

25.

Show HN: Click, use any watch band with Apple Watch(kickstarter.com ↗)

7 points · by lyinsteve · 11y ago · discuss

comment 11y ago · link · parent

    let x: String = {
       if 3 == 4 {
          return "Hello"
       } else {
          return "Goodbye"
       }
    }()
Although in this case, I'd just use ternary.

    let x = (3 == 4) ? "Hello" : "Goodbye"

comment 11y ago · link · parent

This looks really amazing. Probably the most simple implementation of FRP I've ever seen, nonetheless in Swift.
123