
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
NSArray
from Cocoa, represent it as anArray<AnyObject>
, and pass it right back to Cocoa as anNSArray
in 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
NSArray
are eliminated. AnArray
of 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

Forbidden Commands to Speed Up macOS.
First, ask yourself, would you like to undo a decade of security protections painstakingly created...
New

A previously undetected piece of malware found on almost 30,000 Macs worldwide is generating intrigue in security circles, which are stil...
New

Apple announced that it would be moving from Intel processors to Arm-based Apple Silicon CPUs for Macs at WWDC 2020. The Apple Silicon-ba...
New

Goals
Performance equivalent to C arrays for subscript get/set of non-class element types is the most important performance goal.
It sho...
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

Malicious hackers have been exploiting a vulnerability in fully updated versions of macOS that allowed them to take screenshots on infect...
New

In the recent forum thread about shells people use, I got asked to elaborate a bit about the shell configuration I’ve been using for the ...
New

Apple’s leaders continue to deny developers of two obvious truths:
That our apps provide substantial value to iOS beyond the purchase c...
New

Until its recent demise, Internet Explorer was the browser hated most by web developers.
Internet Explorer is now a thing of the past, r...
New

I didn’t think this was possible:
This App Store app [My Metronome - Tempo Keeper] immediately asks you for money and then disables the ...
New
Other popular topics

Please tell us what is your preferred monitor setup for programming(not gaming) and why you have chosen it.
Does your monitor have eye p...
New

I know that -t flag is used along with -i flag for getting an interactive shell. But I cannot digest what the man page for docker run com...
New

New

I am asking for any distro that only has the bare-bones to be able to get a shell in the server and then just install the packages as we ...
New

We’ve talked about his book briefly here but it is quickly becoming obsolete - so he’s decided to create a series of 7 podcasts, the firs...
New

Author Spotlight
James Stanier
@jstanier
James Stanier, author of Effective Remote Work , discusses how to rethink the office as we e...
New

Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
New

A Brief Review of the Minisforum V3 AMD Tablet.
Update: I have created an awesome-minisforum-v3 GitHub repository to list information fo...
New

Curious what kind of results others are getting, I think actually prefer the 7B model to the 32B model, not only is it faster but the qua...
New

Fight complexity and reclaim the original spirit of agility by learning to simplify how you develop software. The result: a more humane a...
New
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /rails
- /js
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /emacs
- /haskell
- /java
- /onivim
- /typescript
- /svelte
- /crystal
- /kotlin
- /c-plus-plus
- /tailwind
- /gleam
- /react
- /ocaml
- /flutter
- /elm
- /vscode
- /ash
- /html
- /opensuse
- /centos
- /php
- /deepseek
- /zig
- /scala
- /sublime-text
- /textmate
- /lisp
- /nixos
- /debian
- /react-native
- /agda
- /kubuntu
- /arch-linux
- /django
- /revery
- /ubuntu
- /spring
- /manjaro
- /nodejs
- /diversity
- /lua
- /julia
- /c
- /slackware
- /markdown