Menu
Sign In Search Podcasts Charts People & Topics Add Podcast API Blog Pricing

Conrad Irwin

๐Ÿ‘ค Speaker
459 total appearances

Appearances Over Time

Podcast Appearances

Rust in Production
Zed with Conrad Irwin

And we looked into it, and it turned out that because our graphics coordinates float 32s, when we were multiplying the line number by the float 32 to try and figure out the distance from the very top of the file, it just didn't work out at all. And so we ended up having to first subtract from the first visible line and then do the offset. And then that just fixed it.

Rust in Production
Zed with Conrad Irwin

And we looked into it, and it turned out that because our graphics coordinates float 32s, when we were multiplying the line number by the float 32 to try and figure out the distance from the very top of the file, it just didn't work out at all. And so we ended up having to first subtract from the first visible line and then do the offset. And then that just fixed it.

Rust in Production
Zed with Conrad Irwin

But it's really interesting to think about, how do you have a file that's so long and you could just edit it without having to rewrite the entire file every time?

Rust in Production
Zed with Conrad Irwin

But it's really interesting to think about, how do you have a file that's so long and you could just edit it without having to rewrite the entire file every time?

Rust in Production
Zed with Conrad Irwin

But it's really interesting to think about, how do you have a file that's so long and you could just edit it without having to rewrite the entire file every time?

Rust in Production
Zed with Conrad Irwin

Well, you can still open files that are big enough that Z will crash. We don't do anything super clever around paging things in yet. But one of the things that we do do is when you load a file, we break it up into a bunch of chunks.

Rust in Production
Zed with Conrad Irwin

Well, you can still open files that are big enough that Z will crash. We don't do anything super clever around paging things in yet. But one of the things that we do do is when you load a file, we break it up into a bunch of chunks.

Rust in Production
Zed with Conrad Irwin

Well, you can still open files that are big enough that Z will crash. We don't do anything super clever around paging things in yet. But one of the things that we do do is when you load a file, we break it up into a bunch of chunks.

Rust in Production
Zed with Conrad Irwin

And so as you're editing a file, we're not having to say, you know, take a evacuate, which is the Rust underlying string type, insert one in the middle and reallocate the rest. That would be way too slow. So when you insert into the middle, we use our CRDT to say, oh, we're just the first end characters from here, then this character, then these end characters.

Rust in Production
Zed with Conrad Irwin

And so as you're editing a file, we're not having to say, you know, take a evacuate, which is the Rust underlying string type, insert one in the middle and reallocate the rest. That would be way too slow. So when you insert into the middle, we use our CRDT to say, oh, we're just the first end characters from here, then this character, then these end characters.

Rust in Production
Zed with Conrad Irwin

And so as you're editing a file, we're not having to say, you know, take a evacuate, which is the Rust underlying string type, insert one in the middle and reallocate the rest. That would be way too slow. So when you insert into the middle, we use our CRDT to say, oh, we're just the first end characters from here, then this character, then these end characters.

Rust in Production
Zed with Conrad Irwin

And so because we're representing it as a tree, kind of like a rope, if you've heard of that data structure, that means that everything is kind of quick. And because it's a CRDT, it also works for collaboration natively. So we know for each chunk who added it and in which order.

Rust in Production
Zed with Conrad Irwin

And so because we're representing it as a tree, kind of like a rope, if you've heard of that data structure, that means that everything is kind of quick. And because it's a CRDT, it also works for collaboration natively. So we know for each chunk who added it and in which order.

Rust in Production
Zed with Conrad Irwin

And so because we're representing it as a tree, kind of like a rope, if you've heard of that data structure, that means that everything is kind of quick. And because it's a CRDT, it also works for collaboration natively. So we know for each chunk who added it and in which order.

Rust in Production
Zed with Conrad Irwin

And so even as multiple people are concurrently editing the string, everyone ends up with the same representation without having to copy and paste everything across.

Rust in Production
Zed with Conrad Irwin

And so even as multiple people are concurrently editing the string, everyone ends up with the same representation without having to copy and paste everything across.

Rust in Production
Zed with Conrad Irwin

And so even as multiple people are concurrently editing the string, everyone ends up with the same representation without having to copy and paste everything across.

Rust in Production
Zed with Conrad Irwin

Exactly. And then one of the things that wraps that that I think is pretty cool is we have to maintain where the line breaks are. And we don't want to scan through the string and figure out where all the line breaks are. And so we maintain a couple of indexes on top so that we know, OK, in this half of the file, there's 1,500 line breaks. In this half of the file, there's more.

Rust in Production
Zed with Conrad Irwin

Exactly. And then one of the things that wraps that that I think is pretty cool is we have to maintain where the line breaks are. And we don't want to scan through the string and figure out where all the line breaks are. And so we maintain a couple of indexes on top so that we know, OK, in this half of the file, there's 1,500 line breaks. In this half of the file, there's more.

Rust in Production
Zed with Conrad Irwin

Exactly. And then one of the things that wraps that that I think is pretty cool is we have to maintain where the line breaks are. And we don't want to scan through the string and figure out where all the line breaks are. And so we maintain a couple of indexes on top so that we know, OK, in this half of the file, there's 1,500 line breaks. In this half of the file, there's more.