Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How’s this language doing? Any big projects on Swift in the last years?


We use Swift on the server at Steamship. Our Swift project is a federated database for NLP data (query, training, inference, embeddings — the whole bit)

I assume folks are familiar with the downsides of Swift on Linux so I’ll focus on what we like about it:

- Fantastic type system

- Good language extensibility (we use Swift to build ourselves a framework to develop Steamship more easily)

- Good LLVM extensibility

- Mostly performant

- Compiled

All in all, we're very happy with the choice. My biggest gripe is slow build & test times in GitHub actions.

If Swift developers are out there and wanting to dig into more systems-style development, I'm happy to chat.


> Mostly performant

I assume that means "efficient at runtime" - but by what metrics? CPU time? Memory usage? Power usage? Latency/responsiveness? Throughput?

What are you comparing it against?

> slow build & test times in GitHub actions

What is the cause of this? Is the generated code slow or just the compiler?


> I assume that means "efficient at runtime" - but by what metrics? CPU time? Memory usage? Power usage? Latency/responsiveness? Throughput?

Not OP, but coming from Python, I find it is liberating to say: I need to write a for-loop for things, and it is OK, not going to be the most efficient thing, but it won't slow me down 1000x and become the major bottleneck. That has been said, Julia probably do the same thing.


Assuming you have to do a lot of string processing (for NLP). Do you have any "shortcut" to do that in Swift? The API is thoughtful, but tedious to type, comparing to Python. It would be great if we have some semi-official "shortcut" libraries just for string processing (The recent RegEx literal is a welcome addition, but not enough).


That's a very gentle way to describe the agony of string processing in Swift :-).

We have written a few shortcut libraries ourselves, but we actually don't end up writing a great deal of string processing code in practice because most of our operations are expressed in a higher level query language that gets compiled down to lower-level operator implementations (which only get written once).

The vast majority of our code (maybe like a lot of systems?) ends up being more about the management of the broader data & processing environment that coordinates everything.


This is a shameless plug, but I built Swift Cloud to help people build scalable backends in Swift: https://swift.cloud

Behind the scenes we compile Swift to WASM and deploy to Fastly's edge network, Compute@Edge. At my day job we are using this in production and serving thousands of requests per second on our Swift app. Overall it's a lot of fun to deploy Swift on server, but the developer UX still leaves a lot to be desired. Running and testing locally is still non-trivial.


This looks great, good work!

One tangential question: do you worry about using "Swift", which I assume is an Apple trademark, in the name of your product?


Thanks so much.

And short answer - Yes.

My guess is it's a matter of 'when' I have to deal with this. I've had the domain for a while, and this is something I've wanted to build for such a long time. Things fell into place when I was able to build a Swift SDK for Fastly's platform back in January this year. The stubborn engineer in me went ahead and used the domain anyway and launched what you see today.


Gotcha, thanks for your answer :)


I already created an account! I’m definitely going to use this the next time I need a little cloud function


Love to hear that! Always feel free to reach out if you have any questions or run into issues.


I have no use for this project, but this seems super cool!


Still macOS language, a lot of cool features but not enough community on linux and for sure windows :/


SwiftUI and Metal look like big projects.


95% of the underlying metal driver is written in cpp.


Of course it is C++, that is what IO and Driver Kits use.

App developers use the Objective-C and Swift userspace libraries.

The newly released header only library for Metal in C++, is a poor man's binding, that wraps the C API of the Objective-C runtime, without the Metal frameworks written in a mix of Swift and Objective-C.


Metal shading language is C++14


Sure, all recent iOS apps


Not really, since so many are React Native. Technically still involves Swift, but eh.


The company I work for uses Swift a lot... that said, the performance sensitive parts of the code is still Cpp.

Swift is nifty but still not Cpp I guess.


Is the company you work for mostly targeting Apple devices?

I'd be interested to hear if there is any large scale Swift usage outside of the Apple ecosystem.

If you are targeting Apple devices, was your performance sensitive code always written in Cpp or did you leave Objective-C for Swift+Cpp? Or, were the Cpp parts inherited and just wrapped with whatever your platform's encouraged language was?

(I used to do contract iOS work but I stopped around the time Swift came out due to taking a rewarding full-time job, so I never really spent much time on Swift beyond "huh, neat")


How does it compare performance wise to cpp in real-life.


Apart from mobile apps? (some of which are among the most widely-used pieces of software in the world)


Yes, preferably those that run outside of iOS/Mac.


AFAIK most people have been moving away from it in favor of Rust and Zig.

A lot of friends at FAANGs are still working in ObjC codebases, and probably gonna skip the whole Swift story by jumping straight to Rust when the time comes.

But of course this could be just in my bubble...


Rust is taking over the tools space for sure, replacing important tools that need to run often and speed is king, replacing tools written in python and perl. Rust is also making its way into new core cross-platform libraries that need speed, instead of C++, however, no one is going to rewrite C++ libraries.

No UI or product team is going to use Rust over Swift (or Kotlin) or whatever your stack currently depends on.


If you mean anything other than iOS apps, sure. But for this latter case, there’s no real alternative. An iOS app in Zig or Rust is in an extremely small niche.


Would be interesting to know the "moving away from Swift to Rust / Zig" story. My impression is that Swift not even in consideration in most projects with Rust / Zig.


I can see some performance-sensitive projects being done in Swift, Rust, or Golang.

Funny, the place I don't like using Swift is its main use case, high-level iPhone apps. It's overkill. The complex Stackoverflow answers for "how to do (simple thing like getting a substring) in Swift" say so.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: