this post was submitted on 19 Oct 2023
1034 points (100.0% liked)

196

18150 readers
388 users here now

Be sure to follow the rule before you head out.


Rule: You must post before you leave.



Other rules

Behavior rules:

Posting rules:

NSFW: NSFW content is permitted but it must be tagged and have content warnings. Anything that doesn't adhere to this will be removed. Content warnings should be added like: [penis], [explicit description of sex]. Non-sexualized breasts of any gender are not considered inappropriate and therefore do not need to be blurred/tagged.

If you have any questions, feel free to contact us on our matrix channel or email.

Other 196's:

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] yetAnotherUser@feddit.de 7 points 2 years ago (8 children)

Ok, I didn't understand roughly half of your comment because I don't actually know how cache works in practice

BUT

a messy pile of clothes represents a stack, doesn't it? And a stack makes a horrible cache because unlike a simple array you don't have fast random access. You'd have to dig through the entire pile of clothes to get to the bottom which takes a lot of time.

[–] Cralder@feddit.nu 10 points 2 years ago (5 children)

Not necessarily. If you know that your pants are at the bottom then you can just plunge your hand into the pile and grab them without any searching.

[–] yetAnotherUser@feddit.de 4 points 2 years ago (4 children)

Thay depends on the size of the pile, there could be a lot of weight and instability above the pants and you'll have to pull them out à la Jenga or carefully rearrange the stack.

Since the amount of rearranging increases for larger n (imagine a pile reaching the ceiling), searching is in ω(1).

[–] Cralder@feddit.nu 6 points 2 years ago

I feel like this metaphor is getting out of hand

load more comments (3 replies)
load more comments (3 replies)
load more comments (5 replies)