Hacker Newsnew | past | comments | ask | show | jobs | submit | taco9999's commentslogin

For bijection, the path through the rationals can just jump over and skip any numbers that have already been visited by the path.



No, the one I saw had little to no code.


What benefits does this have over a standard VecDeque?


The elements are completely contiguous, which can be nice for passing off (subslices) to other APIs, maximum speed iteration, etc.


Does it have to move or resize when one of the sides reaches the end of the array? I presume that would be slower than a ring buffer that only grows when it's completely filled?


Both are O(1) datastructures, but indexing a ring buffer is slightly more costly compared to this and insertion is slightly more costly for this than a ring. Probably usually works out in favor of this design though for net performance usually?


I'd love to see performance numbers for this, if they're available. My hunch is that indexing cost would be about the same.


They both have an offset, but ring buffers aren’t contiguous so they also need a branch or modulus to handle wrap around. Either can be cheap, but clearly that is strictly more costly than not having the extra operation (even if very little). Only matters for random indexing also, since for mutation the situation is swapped


There are many situations where those little differences completely vanish because of instruction pipelining. Only way to know is to actually measure it.


>Does it have to move or resize when one of the sides reaches the end of the array?

Yes, it resizes when that happens, to double the size.


For context: a VecDeque is a ring buffer backed by an array.


> C gives pointers one past the end of an array meaningful semantics

Nelson Elhage wrote about an alternate interpretation: https://blog.nelhage.com/2015/08/indices-point-between-eleme...


A potential issue with that is needing to adjust the distribution of either X or Y, since if X and Y remain uniform, then there will be a lot of points packed into the sides of the circle with higher density than the center column.


Then how would you know if the original random numbers were affected?


Once the hash function is inevitably broken in a few years you can find out.


> kitchen knives were made impossible to use for homicide

Can't wait for kitchen knives that immediately self-destruct if you use them on items that didn't come from the knife manufacturer's grocery store.



wow thanks

what is 3b1b "hidden" channel -- is this official too


Probably not, since there will be a warning screen displayed on boot if the bootloader is unlocked.


And wouldn't I see that warning?


See: https://xkcd.com/488/

Also, since a lot of different movie streaming services (e.g. Hulu, Disney+) have launched, a lot of content has moved off of Netflix, leading to a higher piracy rate.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: