
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

Nice to see the chip space being shook up - look forward to when we have 64 Core+ chips in our personal computers :nerd_face:
Also good ...
New
New

We’ll guide you through the process of using Homebrew package manager to install security tools on macOS to exploit vulnerabilities found...
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

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

The story of Apple CEO Steve Jobs is one of the most familiar in American business — shaggy Bob-Dylan-loving kid starts a computer compan...
New

I’m a bit of a sustainability nerd. I love the idea of living a life where your carbon footprint is neutral (or negative) and you leave t...
New

macOS has a wonderful input mechanism where you press and hold a key on your keyboard to display the accent menu. It’s easy to internaliz...
New

Recommended settings for Wi-Fi routers and access points.
For the best security, performance, and reliability, we recommend these settin...
New
Other popular topics

I’m thinking of buying a monitor that I can rotate to use as a vertical monitor?
Also, I want to know if someone is using it for program...
New

Bought the Moonlander mechanical keyboard. Cherry Brown MX switches. Arms and wrists have been hurting enough that it’s time I did someth...
New

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

Hello content creators! Happy new year. What tech topics do you think will be the focus of 2021? My vote for one topic is ethics in tech...
New

Not sure if following fits exactly this thread, or if we should have a hobby thread…
For many years I’m designing and building model air...
New

API 4
Path:
/user/following/
Method:
GET
Description:
Returns the list of all names of people whom the user follows
Response
[
{ ...
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

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

The File System Access API with Origin Private File System.
WebKit supports new API that makes it possible for web apps to create, open,...
New

Hello,
I’m a beginner in Android development and I’m facing an issue with my project setup. In my build.gradle.kts file, I have the foll...
New
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /rails
- /js
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /emacs
- /haskell
- /onivim
- /svelte
- /typescript
- /crystal
- /c-plus-plus
- /kotlin
- /tailwind
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /ash
- /opensuse
- /centos
- /php
- /deepseek
- /html
- /scala
- /zig
- /sublime-text
- /debian
- /textmate
- /nixos
- /lisp
- /agda
- /react-native
- /kubuntu
- /arch-linux
- /ubuntu
- /revery
- /django
- /spring
- /manjaro
- /diversity
- /nodejs
- /lua
- /slackware
- /julia
- /c
- /markdown