Bit-twiddling optimizations in Zed's Rope
31–40 of 51 posts
Re: Bit-twiddling optimizations in Zed's Rope
#32nth_set_bit_u64: wouldn't that be __builtin_ctzll(_pdep_u64(1<<n, v)) with BMI2?
Re: Bit-twiddling optimizations in Zed's Rope
#33Is there a way to adjust text contrast in light mode in Zed yet? The editor is unfortunately unusable for me, because of how washed out the colors are.
Re: Bit-twiddling optimizations in Zed's Rope
#34You don't need information about the position of newlines in all the chunks located before the one your offset lands on
Re: Bit-twiddling optimizations in Zed's Rope
#35I really like all the blog posts and videos the Zed team has put out, thank you if you’re reading this! Unrelated to this specific post I’m such a fan of Zed. It’s the first feature complete text editor in recent memory that I’ve truly enjoyed using (i.e. it stays out of the way, is really fast, feels well engineered). I’m coming to Zed after years of Emacs which I still have love for but no longer feels like a compe…
> it does not take full advantage of how good computers are today, e.g. gpu rendering or multicore Why does Emacs need that though? I hear people say this all the time and I don't get it. Multicore kind of works against the structure that Emacs touts as a feature. And GPU rendering? In many applications, I totally agree with these complaints. But it's a text editor. I tried Zed myself, and it's good. But it doesn't d…
Re: Bit-twiddling optimizations in Zed's Rope
#36The are serious about local vs. remote vs. shared. They are serious about hardware acceleration because they care about users who type fast and edit big files. They care about real computer science on how to push the current hardware to serve the user, rather than treating the hardware as a crutch to give the user a slightly worse experience at a fraction of the development cost. They care about code highlighting the snippets on their blog like very similar to the default Zed theme.
These are cool, serious people. If they give me emacs key bindings with full paredit-everywhere, I might switch my daily driver.
And this is about using modern SIMD-style stuff, branch less stuff, Lemire stuff in a modern and relevant context. Other commenters have pointed out that you can do the mask or popcount better with intrinsically, and yeah, but they probably know that, and B. They got the massive win, the remaining factor of K on the pop count is coming.
Long Zed.
Re: Bit-twiddling optimizations in Zed's Rope
#37Why not store just a small u8 count of newlines in a chunk instead of their u128 positions and then only loop through the last chunk for precision? You don't need information about the position of newlines in all the chunks located before the one your offset lands on
Re: Bit-twiddling optimizations in Zed's Rope
#38Why not store just a small u8 count of newlines in a chunk instead of their u128 positions and then only loop through the last chunk for precision? You don't need information about the position of newlines in all the chunks located before the one your offset lands on
As I understand it, they do exactly what you say. TFA is about optimizing the last chunk's loop.
Re: Bit-twiddling optimizations in Zed's Rope
#39Earlier quoted context omitted.
As I understand it, they do exactly what you say. TFA is about optimizing the last chunk's loop.
Maybe I got confused, but how do they then count the newlines in all the previous chunks? That information is still needed to calculate the line for a specific position in the last chunk
> If you called rope.offset_to_point(7234), the Rope would traverse its SumTree to find the Chunk that contains offset 7234 and then, on that Chunk, it would call offset_to_point again.
And here:
> while the Rope can get us to the right Chunk in O(log(n))
I would guess that each node of the SumTree includes the number of newlines of all the chunks before it.