build-your-own-redis icon indicating copy to clipboard operation
build-your-own-redis copied to clipboard

Swift language added to Redis Course

Open bobvoorneveld opened this issue 1 year ago • 1 comments

bobvoorneveld avatar Mar 13 '24 16:03 bobvoorneveld

Hmm, I'm struggling to get caching working here. Even after running swift build inside the dockerfile, compile times are 60s+.

Screenshot 2024-03-19 at 20 44 04

This'd make our test runners practically unusable - the longest I've seen for other languages is ~10s (Haskell, I think).

I suspect that we might need to do something hacky like we do for Rust here: https://github.com/codecrafters-io/build-your-own-redis/blob/c5b3c42749805e2013250bde363f0c46841afa2d/dockerfiles/rust-1.76.Dockerfile#L7-L21.

@bobvoorneveld ideas? I've pushed up one commit which was an attempt to incremental compilation working.

rohitpaulk avatar Mar 19 '24 20:03 rohitpaulk

I haven't looked too deeply into the build system, but it sounds like you're having a similar problem to the one in this thread I found in the swift community, and this particular comment has a suggestion for how to write a Dockerfile for incremental builds. I'm not sure if you've already seen this or not, but I thought it might help.

abstractJohn avatar May 04 '24 01:05 abstractJohn

@abstractJohn, I'll have a look. Wasn't succesful when trying to get intermediate builds, which is a shame. I'll give it another try!

bobvoorneveld avatar May 11 '24 09:05 bobvoorneveld

I've tried, but I'm not familiar enough with swift + docker to get intermediate builds working. SwiftNIO is a big depencency that will create a long build time, which makes it hard to speed up compile times. I'm closing this PR, maybe someone else can create a PR in the future to make this possible. I've created a PR for Build Your Own Git and swift as an alternative, hopefully that will attract some swift developers that can help in the future.

bobvoorneveld avatar May 11 '24 14:05 bobvoorneveld