@lizzy did you know that in Swift, arrays are reference types (so you can have shared references to them), and also internally mutable (so you can always mutate them from everywhere), yet they behave as value types that can never have aliased observed mutability? this is because they are reference automatically reference counted, so that when an array is mutated, it can check the reference count. if there is a single unique reference, Swift can just mutate it in place, but if there is another reference, it will first copy the array’s contents into a new array, and make your variable point to the new, copied array. then, it will mutate the newly created array.
this is a scheme called Copy-on-Write, which is more efficient than cloning the array every time you need another copy of it, because you just share a reference to the same array and only pay the cost right before it would be problematic to share the array.
it is commonly abbreviated CoW, which reminds me of how adorable you surely look with that bell fixed to your head like a milky mammal moo moo bitch ❤️ have you considered buying a onesie to match
@lizzy gonna hide my cow related refences behind other languages like uhhh, koe
@lizzy @kimapr yeah! btrfs uses exactly the same technique when copying files! although there, the reason is slightly different. although it does save memory usage in Swift, that’s usually abundant and even for small arrays CoW is really useful because the act of allocating memory is in itself very slow and constantly copying immutable data upon function calls cab cause tremendous effects on application performance; compared to a filesystem where copying generally isn’t that slow (I mean, filesystem operations are already REALLY FUCKING SLOW in general) and it’s actually not that often you’re copying lots of files without mutating them; this isn’t like a hot path, it can be slow, HOWEVER backups are a thing!! and while backing up on the same volume does NOT help recover from drive failures it can be a very useful way to recover “oh oopsie I accidentally deleted this file and I want it back”, and with a CoW filesystem, you can automatically make a copy of your entire filesystem like, say, every day, or even every hour. For one, the backup process is basically a trivial increment so it’s very fast, but the main benefit is that it takes BARELY ANY SPACE AT ALL and you only pay for backup costs in the files that change afterwards!!! So, you can have a 3 TB volume with like 2 TB of files on it and hundreds of backups of those files that barely take any space until those files actually change!!!
@lizzy only by suffocation in your cattle milkers listening to the sound of that bell as I go out ❤️
@lizzy I also had a bell fixed to my hair the other day; deer style
@lizzy aww honestly that’s kinda cute assuming it doesn’t become super annoying
@Suiseiseki @lizzy
where did this question come from
you aren’t even fediblocked? if that was true how did your replies arrive
@Suiseiseki @lizzy Keep in mind that the link you posted doesn’t work if the blocking instance hides who it’s blocking, which a lot of instances do. Mine is blocked by at least 3 instances but that thing only shows monads.online.
@dagda @sodiboo @lizzy @mischievoustomato holy shit gigachadette
@lizzy @sodiboo @dagda @mischievoustomato i have never seen her