Archive for January 23, 2016

Saturday, January 23, 2016

Exploring Swift Dictionary’s Implementation

Ankit Aggarwal:

There are multiple ways to store these (key, value) records one of which is open addressing with linear probing which is used by swift’s dictionary implementation.

[…]

Bitmap value of a bucket tells if the key and value in that bucket is valid and initialized or not. If not, then that bucket is called a hole.

[…]

Also note that the end of bucket array is connected to start of the bucket array forming a logical ring. This just means that if you’re at end of the bucket array and you call next method, you’ll end up at begining of the array.

[…]

squeezeHashValue does try to create a good hash by applying some transformation operations.

Also it looks like to keep hashValues different across executions, execution speed was supposed to mixed with hashValue provided by the Key type but its a constant placeholder value for now

[…]

[_NativeDictionaryStorageOwner] was created to keep track of correct reference count for Copy on Write feature, since the storage will be referenced by Dictionary and DictionaryIndex both, reference count will be 2 for the storage but if Dictionary refers this class and reference count of this class is tracked, everything should be fine.

[…]

If a Value has to be removed from the bucket array, we might end up creating a hole which might cause side effect of probing to stop earlier than expected. To take care of that the elements are rearranged at their ideal position.

Previously: Exploring Swift Array’s Implementation, Exposing NSDictionary.

Unsteady Platform

Daniel Jalkut:

I’m scratching my head. Did it somehow get removed as a dependency? But then I notice something subtle. It’s looking for the framework in the “Release” build folder, but for my iOS build it should be looking in “Release-iphoneos”. What the heck is going on?

[…]

If any target in a Scheme’s dependency tree targets OS X, then the scheme itself will also be considered to target OS X.

[…]

This must be at least a relatively common scenario for iOS builds of certain complexity. Because the platform on which all iOS builds run is OS X, any helper tools that are compiled and used in the process of generating sources or otherwise processing build materials, must be built for OS X.

iPhone 5se Rumors

Mark Gurman:

Sources have provided the following list of “iPhone 5se” upgrades over the 5s:

The chamfered, shiny edges have been replaced with curved glass like on the iPhone 6 and 6s lines

Hopefully not, because the curved glass is much less comfortable to hold.

Update (2016-01-29): Manton Reece:

I can understand wanting consistency between models, but the iPhone 6 sleep button is a major usability issue because it gets in the way when trying to use the volume buttons. I’ll be disappointed if the design trade-offs from the 6 make the 5se worse.