@lorentey@mastodon.social
@lorentey@mastodon.social avatar

lorentey

@lorentey@mastodon.social

Swift Standard Library at Apple

he/him ๐Ÿณ๏ธโ€๐ŸŒˆ

This profile is from a federated server and may be incomplete. Browse more on the original instance.

ctietze, to random
@ctietze@mastodon.social avatar

@lorentey I read your 2021 forum post that a mutable SortedArray would be impractical after ~2000 items
https://forums.swift.org/t/add-sortedarray-sortedset-and-sorteddictionary-with-binary-search/47303/2

Is that because of resizing the array or the search that is required to look for a fitting index, or both?

Do you have benchmark code lying around by chance?

lorentey,
@lorentey@mastodon.social avatar

@ctietze This is primarily because insertions and removals have complexity thatโ€™s linear in the size of the array โ€” they have to slide existing items to make room for a new one or to close gaps after a removal.

Arrays have benefits on small sizes because they are compact. Beyond a couple thousands or so items, this advantage is entirely eclipsed by all these movement costs: they become unbearably slow.
[1/2]

lorentey, to random
@lorentey@mastodon.social avatar

A wild Swift evolution pitch appears! It overhauls some fundamental Standard Library constructs to allow building things using noncopyable types. It's super effective, I hope

https://forums.swift.org/t/pitch-noncopyable-standard-library-primitives/71566

lorentey, to random
@lorentey@mastodon.social avatar

Current status: sinking back into electronics to teach 3d printed things to move. Itโ€™s a hobbyception!

lorentey,
@lorentey@mastodon.social avatar

Itโ€™s alive! ๐Ÿ‘จ๐Ÿผโ€๐Ÿ”ฌ๐Ÿ”ฌ๐Ÿ”ญ

video/mp4

lorentey,
@lorentey@mastodon.social avatar

Cleaning up the ratโ€™s nest at the back will be a nice project for another day

video/mp4

lorentey,
@lorentey@mastodon.social avatar

@schwa Not that much โ€” IIRC about 4 days for the four digits! Lots of 2-hour prints, with a few 5-6 hour long ones sprinkled in

lorentey, to random
@lorentey@mastodon.social avatar

๐Ÿšข swift-collections 1.1.0 is out, shipping Heap, TreeSet/TreeDictionary and BitSet/BitArray types
https://github.com/apple/swift-collections/releases/tag/1.1.0

lorentey, to random
@lorentey@mastodon.social avatar

Achievement unlocked: I spent a day playing with corrosive hydraulic break fluid without incident, then over dinner I proceeded to splash some spicy ramen directly in my eye

lorentey, to random
@lorentey@mastodon.social avatar

Oh gosh, Swift atomics have been accepted! โš›๏ธ ๐ŸŽ‰ This was really quite arduous to bring up, with dozens and dozens of alternative API designs tried, even ignoring all the compiler-level work. We agonized over every detail.

The final variant includes some great API refinements over the swift-atomics package, courtesy of mโ€™colleague Alejandro โ€” the actual atomic operations are no longer coming from protocol requirements! ๐Ÿง™๐Ÿผโ€โ™‚๏ธ

https://forums.swift.org/t/accepted-with-modifications-se-0410-atomics/69244/3

lorentey, to random
@lorentey@mastodon.social avatar

Initial report from my New York expedition:

  • Big
  • It smells like home
  • The Met has some pieces of art on display
  • The natives seem friendly
  • The quality of food in museum cafes seems inversely proportional to the quality of objects on display
  • The subway rats are adorable
lorentey, to random
@lorentey@mastodon.social avatar

Americans will do anything to avoid using sensible date formats

lorentey, to random
@lorentey@mastodon.social avatar

Good news: I got my new shots for Covid & the flu ๐ŸŽ‰

Bad news: I had to stop on the way to CVS to clean my glasses, but it didnโ€™t help โ€” the smudge is in the air. Fire season is here again. ๐Ÿ˜ณ

lorentey, to random
@lorentey@mastodon.social avatar
krzyzanowskim, to random
@krzyzanowskim@mastodon.social avatar

deleted_by_author

  • Loading...
  • lorentey,
    @lorentey@mastodon.social avatar
    lorentey, to random
    @lorentey@mastodon.social avatar

    Breaking news: I have just fallen over in spectacularly silly slow motion while trying to get off my bike, directly in front of my neighbor.

    Damages: one slightly scraped knee, one irreparably shattered self esteem.

    (I was on a borrowed bike and it was set slightly too high for me! ๐Ÿคญ)

    lorentey, to random
    @lorentey@mastodon.social avatar

    The Snoopy watch face is delightful!

    ctietze, to random
    @ctietze@mastodon.social avatar

    Anyone else still mad at 's index(_:offsetBy:limitedBy:) being so cumbersome to use with endIndex? ๐Ÿคš

    lorentey,
    @lorentey@mastodon.social avatar

    @ctietze that but mostly the fact that it fails to indicate just how many steps it did manage to take ๐Ÿ˜ž

    lorentey, to random
    @lorentey@mastodon.social avatar

    Noodle turned one year old today! ๐Ÿถ

    nicklockwood, to random
    @nicklockwood@mastodon.social avatar

    tip: if you need to bind a non-optional value to a temporary variable inside a conditional statement, you can use case let, e.g:

    if indexPath.section < sections.count,
    case let section = sections[indexPath.section],
    indexPath.row < section.rows.count,
    case let row = section.rows[indexPath.row],
    row.isEnabled
    {
    ...
    }

    This saves you needing to split up the condition into multiple statements, and polluting the local namespace with temporary variables you don't need again.

    lorentey,
    @lorentey@mastodon.social avatar

    @ctietze @nicklockwood Just popping in to note that there is only one String.Index type, shared across all string views. (The indexing model would in fact be simpler to understand/implement if each view had its own index type, but that was deemed too inconvenient. Nevertheless, creating named wrapper types to implement ad hoc subtypes is a highly useful technique, and it should be encouraged and normalized, rather than ridiculed.)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • โ€ข
  • anitta
  • khanakhh
  • thenastyranch
  • Youngstown
  • hgfsjryuu7
  • slotface
  • rosin
  • InstantRegret
  • tacticalgear
  • kavyap
  • osvaldo12
  • everett
  • DreamBathrooms
  • PowerRangers
  • tester
  • magazineikmin
  • Durango
  • mdbf
  • ngwrru68w68
  • modclub
  • cubers
  • vwfavf
  • ethstaker
  • cisconetworking
  • GTA5RPClips
  • normalnudes
  • Leos
  • provamag3
  • All magazines