CommunityNews
The Swift Array Design
Goals
- Performance equivalent to C arrays for subscript get/set of non-class element types is the most important performance goal.
- It should be possible to receive an
NSArrayfrom Cocoa, represent it as anArray<AnyObject>, and pass it right back to Cocoa as anNSArrayin O(1) and with no memory allocations.- Arrays should be usable as stacks, so we want amortized O(1) append and O(1) popBack. Together with goal #1, this implies a
std::vector-like layout, with a reserved tail memory capacity that can exceed the number of actual stored elements.To achieve goals 1 and 2 together, we use static knowledge of the element type: when it is statically known that the element type is not a class, code and checks accounting for the possibility of wrapping an
NSArrayare eliminated. AnArrayof Swift value types always uses the most efficient possible representation, identical to that ofContiguousArray…
https://github.com/apple/swift/blob/main/docs/Arrays.rst
This thread was posted by one of our members via one of our news source trackers.
Popular Macos topics
Apple’s Shifting Differentiation.
Apple is about the integration of hardware and software, but the balance between the two has shifted o...
New
The release of Apple Silicon-based Macs at the end of last year generated a flurry of news coverage and some surprises at the machine’s p...
New
Fed up with the Mac, I spent six months with a Linux laptop. The grass is not greener on the other side
April 02, 2021 — Carlos Fenollosa...
New
We’re all familiar with the Mac’s startup chime. While it has changed over the years, it has greeted users with its friendly tone for dec...
New
Apple Now Selling More M1 Macs Than Intel-Based Models, Says Tim Cook.
Despite only being released in November, sales of the M1-powered ...
New
Swift is about to get its Concurrency features. Their development is going very well, with many proposals actively reviewed and a lot of ...
New
Swift 5.5 is here with Xcode 13 Beta and with it comes my favorite new addition to Swift: Async/Await.
Async/await is a high level, stru...
New
Made a small video today showing the creation of a macOS Droplet using AppleScript. I made it just for fun, and because I realised that m...
New
Learn how to use the brand new actor model to protect your application from unwanted data-races and memory issues.
New
Safari isn’t protecting the web, it’s killing it.
There’s been a lot of discussion recently about how “Safari is the new IE” (1, 2, 3, 4...
New
Other popular topics
My first contact with Erlang was about 2 years ago when I used RabbitMQ, which is written in Erlang, for my job. This made me curious and...
New
poll
poll
Be sure to check out @Dusty’s article posted here: An Introduction to Alternative Keyboard Layouts It’s one of the best write-...
New
This looks like a stunning keycap set :orange_heart:
A LEGENDARY KEYBOARD LIVES ON
When you bought an Apple Macintosh computer in the e...
New
Hello everyone! This thread is to tell you about what authors from The Pragmatic Bookshelf are writing on Medium.
New
A few weeks ago I started using Warp a terminal written in rust. Though in it’s current state of development there are a few caveats (tab...
New
This is going to be a long an frequently posted thread.
While talking to a friend of mine who has taken data structure and algorithm cou...
New
If you want a quick and easy way to block any website on your Mac using Little Snitch simply…
File > New Rule:
And select Deny, O...
New
New
Author Spotlight:
Bruce Tate
@redrapids
Programming languages always emerge out of need, and if that’s not always true, they’re defin...
New
Big O Notation can make your code faster by orders of magnitude. Get the hands-on info you need to master data structures and algorithms ...
New
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /python
- /js
- /rails
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /emacs
- /haskell
- /svelte
- /typescript
- /onivim
- /kotlin
- /c-plus-plus
- /crystal
- /tailwind
- /react
- /gleam
- /ocaml
- /elm
- /flutter
- /vscode
- /ash
- /html
- /opensuse
- /zig
- /centos
- /deepseek
- /php
- /scala
- /react-native
- /lisp
- /textmate
- /sublime-text
- /nixos
- /debian
- /agda
- /django
- /deno
- /kubuntu
- /arch-linux
- /nodejs
- /revery
- /ubuntu
- /manjaro
- /spring
- /lua
- /julia
- /diversity
- /markdown
- /c









