Skip to content

Commit 046b25b

Browse files
davelesterDave Lester
andauthored
Revise blog post based on @dempseyatgithub's suggestions in PR #1026. (#1029)
Co-authored-by: Dave Lester <[email protected]>
1 parent 2a1a014 commit 046b25b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

_posts/2025-06-02-swift-at-apple-migrating-the-password-monitoring-service-from-java.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ One of the most significant aspects of Swift that impressed us was its emphasis
4141

4242
Safety is another area where Swift takes a distinctive approach compared to Java. For example, Swift’s optional type and safe unwrapping mechanisms eliminate the need for null checks everywhere, reducing the risk of null pointer exceptions and enhancing code readability. This safety-first approach ingrained throughout Swift’s language design, whether it is deterministic deallocation, copy-on-write (CoW), or value types, makes it inherently less prone to runtime errors.
4343

44-
Swift's async/await support is a nice addition, streamlining how we handle async tasks. Earlier managing async operations often involved complex callback patterns or external libraries. Swift’s async/await syntax simplifies this process, making it more intuitive and less error-prone. We can now write async code that reads like sync code, leading to more readable, testable, and maintainable concurrency handling—especially critical in high-load, multi-threaded environments.
44+
Swift's async/await support is a nice addition, streamlining how we handle async tasks. Previously, managing async operations often involved complex callback patterns or external libraries. Swift’s async/await syntax simplifies this process, making it more intuitive and less error-prone. We can now write async code that reads like sync code, leading to more readable, testable, and maintainable concurrency handling—especially critical in high-load, multi-threaded environments.
4545

4646
Overall, our experience with Swift has been overwhelmingly positive and we were able to finish the rewrite much faster than initially estimated. Swift allowed us to write smaller, less verbose, and more expressive codebases (close to 85% reduction in lines of code) that are highly readable while prioritizing safety and efficiency.
4747

@@ -51,7 +51,8 @@ Our service benefited from a diverse ecosystem of Swift packages, including [log
5151

5252
We benchmarked performance throughout the process of development and deployment, allowing us to discover the trait of the Swift programming language that delighted us the most — its efficiency.
5353

54-
Swift’s deterministic memory management led to a much lower memory threshold for our service. Not only were our initial results heartening, but after a few iterations of performance improvements, we had close to 40% throughput gain with latencies under 1 ms for 99.9% of requests on our current production hardware. Additionally, the new service had a much smaller memory footprint per instance — in the 100s of megabytes — an order of magnitude smaller compared to the 10s of gigabytes our Java implementation needed under peak load to sustain the same throughput and latencies. This allowed us to use about 50% of the original hardware in production.
54+
Swift’s deterministic memory management led to a much lower memory threshold for our service. Not only were our initial results heartening, but after a few iterations of performance improvements, we had close to 40% throughput gain with latencies under 1 ms for 99.9% of requests on our current production hardware. Additionally, the new service had a much smaller memory footprint per instance — in the 100s of megabytes — an order of magnitude smaller compared to the 10s of gigabytes our Java implementation needed under peak load to sustain the same throughput and latencies. The service runs on Kubernetes, and the migration's efficiency improvements allowed us to release about 50% of its capacity for other workloads.
55+
5556
<div style="margin: 2em auto;">
5657
<img
5758
alt="Resource Utilization Comparison between java vs swift."

0 commit comments

Comments
 (0)