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
How Apple’s rivals plan to catch up with the mighty M1 chip.
Apple Silicon is just getting started yet the initial reaction has been rap...
New
What is ownership?
Ownership is the responsibility of some piece of code to eventually cause a value to be destroyed. An ownership system...
New
Safari supports WebGPU experimentally with WSL kernels. I wrote a simple tuner that tries to optimize matrix multiplication. If you have ...
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
The Swift concurrency model intends to provide a safe programming model that statically detects data races and other common concurrency b...
New
Over the past few years, Apple seems increasingly willing to cooperate with authoritarian governments, uninterested in protecting its own...
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
Executive Summary
TCC is meant to protect user data from unauthorized access, but weaknesses in its design mean that protections are eas...
New
This sample code project demonstrates how to install and run macOS virtual machines on Apple Silicon using the Virtualization framework. ...
New
Other popular topics
Brace yourself for a fun challenge: build a photorealistic 3D renderer from scratch! In just a couple of weeks, build a ray tracer that r...
New
Which, if any, games do you play? On what platform?
I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
New
@AstonJ prompted me to open this topic after I mentioned in the lockdown thread how I started to do a lot more for my fitness.
https://f...
New
New
Just done a fresh install of macOS Big Sur and on installing Erlang I am getting:
asdf install erlang 23.1.2
Configure failed.
checking ...
New
Think Again 50% Off Sale »
The theme of this sale is new perspectives on familiar topics.
Enter coupon code ThinkAgain2021 at checkout t...
New
Rails 7 completely redefines what it means to produce fantastic user experiences and provides a way to achieve all the benefits of single...
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
This is a very quick guide, you just need to:
Download LM Studio: https://lmstudio.ai/
Click on search
Type DeepSeek, then select the o...
New
Node.js v22.14.0 has been released.
Link: Release 2025-02-11, Version 22.14.0 'Jod' (LTS), @aduh95 · nodejs/node · GitHub
New
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /ruby
- /wasm
- /erlang
- /phoenix
- /keyboards
- /python
- /js
- /rails
- /security
- /go
- /swift
- /vim
- /clojure
- /emacs
- /haskell
- /java
- /svelte
- /onivim
- /typescript
- /kotlin
- /crystal
- /c-plus-plus
- /tailwind
- /react
- /gleam
- /ocaml
- /flutter
- /elm
- /vscode
- /ash
- /html
- /opensuse
- /zig
- /centos
- /deepseek
- /php
- /scala
- /react-native
- /lisp
- /textmate
- /sublime-text
- /debian
- /nixos
- /agda
- /django
- /kubuntu
- /arch-linux
- /deno
- /nodejs
- /revery
- /ubuntu
- /spring
- /manjaro
- /lua
- /diversity
- /markdown
- /julia
- /c








