News for hackers. Stuff that matters.
Re:Go is not an easy language by pansa2 on Monday February 22, 2021 @01:39AM (#26221527)
Linked-lists, maybe, but `list`s in Python are just resizable arrays.
Re:Go is not an easy language by kindall on Monday February 22, 2021 @02:21AM (#26221737)
resizable arrays of pointers to objects stored elsewhere, which is going to blow through your cache anyway, especially when you start accessing those objects' attributes. so it's more a memory management strategy than a performance optimization.
Re:Go is not an easy language by pansa2 on Monday February 22, 2021 @02:56AM (#26221945)
But when removing an item it’s not necessary to visit every element, just re-arrange the pointers (and in CPython, modify the reference count of the item that was removed).
Re:Go is not an easy language by sokoloff on Monday February 22, 2021 @07:44AM (#26223838)
When removing an item by value (being the use case in this thread), you do need to visit the elements to check the value.
Re:Go is not an easy language by hiptobecubic on Monday February 22, 2021 @10:02PM (#26233420)
Yes but the problem there is not that your list is backed by a linked list or an array, it's that every single value is boxed and needs dereferencing. The difference between no hops and one hop totally trumps one hop vs two hops.