Now, all these threads, when they are spawned, they are not aware of each other. Like, they just do one job. At the end, they have to report something, like if there are errors, or if not, like any kind of information. In order to do so, we use channels.
So, you have all these files. For each file, we have these threads. There are n threads, depending on the operating system. Then we have the main thread. So, the main thread waits for all these threads. And it starts collecting information from all the threads.
So, using these channels, we have multiple channels with multiple senders, which are essentially the threads. And one receiver, which belongs to the main thread. And once there are diagnostics, we collect them. We collect if there are warnings, errors. If, like, we skipped like some diagnostics due to some restrictions or options and things like that. So, that's how the communication happens. And once all the threads are died, the main thread can resume its work and report everything to your console.
And then we have reusable tokens. So, essentially, what does that mean? So, once biome parses your file, it creates tokens and nodes. These are essentially pointers to a block of memory on your operating system. And these pointers are saved, like the references are saved into a caching object. Okay? Once a reparse of the same file happens again, let's say a code action occurred and that action changes this snippet from let to const. We do a reparse to make sure that there are no more triggered rules. When we reparse it, essentially, the nodes that belong to msecret equals and the string are reused. So, instead of creating a new node, we have it there already. So, we have that reference that says that msecret points to that block of memory. Let's just use it. Let's not create a new one. So, that's how for each document we reuse the same thing. So, like memory wise, there's no waste at all.
Comments