How is the Library of Babel website isn’t lagging like crazy?

247 views

How is the Library of Babel website isn’t lagging like crazy?

In: 0

3 Answers

Anonymous 0 Comments

the idea of the library of babel is the old “can a monkey on a typewriter write shakespeare given infinite time?” thanks to pseudorandom number generators we don’t actually need a monkey and we don’t need to make it type ahead of time and store the books it types.

“pseudorandom” means that the numbers a generator makes are not truly random, though they’re close enough to random that they can substitute for true random numbers. you start with a seed number, and then the pRNG algorithm does math to it to expand it into an infinite string of numbers, which the library then converts into letters and chops up into books.

because it’s pseudorandom and not true random, if you use the same seed you’ll always get the same string of numbers.

so they don’t have to store all those books. when you type in a query or browse the shelves, they just run the pRNG until it gets to whatever you’re looking for. then when you’re done they delete the data, and generate it again when someone else queries it. since it always uses the same seed, everyone gets the same set of books every time they use the library, but they don’t actually need to store the books.

Anonymous 0 Comments

The secret of the site is very simple: when you go to the site, it asks you to pick a hexagonal chamber: each given a “code” of digits and letters. You may notice, that the maximum length of the name is 3200 characters. That’s exactly the size of one page!

So when you select a “hexagonal chamber”, you actually type a page of text! All books in the chamber are just some smart (but reversible) letter substitutions of that page.

When you use “search” function, it doesn’t search anything – it creates a page with a content you want, and then uses reverse substitution to get a “chamber code”.

Doing a substitution on 3200 characters is not a problem for a computer.

Anonymous 0 Comments

A typical website has a bunch of data that lives inside of it. When you do a search on that website, the website has to flip through everything it has looking for matches, and then serve anything it finds back to you. This can be a very intensive process.

The Library of Babel does not do this. It does not have any data. What it has instead is a clever little black box. The box can take in any string of characters (from the set it lets you use, up to a certain max length) and from those characters it will spit out an address. Or, it can take in an address and spit back out the string of characters.

Due to the way the box is built, this is always a 1-to-1 mapping. That is, each possible string of characters always generates the same address every time, and each possible address always generates the same string of characters every time. There are also no leftovers; every possible string has an address and every possible address has a string.

What this allows the website to do, then, is take your “search”, feed it into the black box, and spit out an address (the room/wall/shelf/book/page number). The website then uses some smoke and mirrors to make it *look* like it “takes you to” that place. You don’t truly “”go”” anywhere in this process, the website merely spits out exactly what you gave it, plus some surrounding content auto-generated through the same black box on the fly.

Browsing the site instead of searching is just the same process in reverse. By navigating around the rooms and shelves, you’re essentially just searching using addresses. The site can feed those addresses into the black box to get strings of text to show you.

Since no actual searching is really being done here, just on-the-fly generation of content, the Library of Babel is very fast.