Live data from Hacker News

Rewriting a high performance vector database in Rust

pinecone.io

91–100 of 157 posts

Re: Rewriting a high performance vector database in Rust

#91
post #72
post #61

Earlier quoted context omitted.

Memory sanitizers, address sanitizers, leak sanitizers, threading sanitizers, undefined behaviour sanitizers. The visual studio core guidelines checker. The clang-tidy core guideline checker. I could go on but my point is, the landscape does not really look like how you've painted it.

I know about these, but there is a marked difference between Rust and these tools. Static analysis tools have much harder job analyzing C++ (aliasing and escape analysis are way harder, and static analysis of thread-safety is basically impossible due to lack of thread-safety info in the type system). The results are a trade-off between being sparse or having false positives. The sanitizers only catch issues they can…

The results are a trade-off between sparse or having false positives.

Rust just takes the other side of the trade-off, and will reject valid programs. Hence why the unsafe keyword exists, and why tools like Miri (https://github.com/rust-lang/miri) exist specifically for rust.

Re: Rewriting a high performance vector database in Rust

#92

I have no problem with people rewriting their projects in whatever language they see fit. What stood out for me in the article is him saying that it's difficult getting developers with experience in both Python and C++. So, I wonder, if his in-house devs could pick up Rust that they previously couldn't write, why does he think he can not hire a good programmer and charge him to learn the stack the company uses. Why m…

The footgun-to-appropriate-feature ratio is higher with C++ than Rust. Rust also has some excellent Python integration options that are relatively easy to use.

Re: Rewriting a high performance vector database in Rust

#94
post #79
post #57

Earlier quoted context omitted.

It takes longer to learn how to use C++ to the same level of proficiency and correctness compared to Rust, in my experience. It's harder to write an incorrect program in Rust.

What are the main correctness risks in C++ if you just never use a raw pointer?

One thing off the top of my head, from experience:

std::string s(s);

To be fair, compilers will warn you about this nowadays. But when I converted a C codebase to C++ 20 years ago they didn't.

IIRC, references can also refer to de-allocated memory. Also, if you don't pass-by-reference or pointer, you can literally "slice" the dynamic doohickies off your instance so your AlbinoCat behaves like a Cat because all that extra special stuff is gone as far as the function is concerned.

This is just off the top of my head after not working with C++ for 20 years. I'm sure with all the new features it's gained over the past 20 years theres whole new exciting ways to blow your leg off.

Re: Rewriting a high performance vector database in Rust

#95

>In addition, it’s challenging to find developers with experience in both Python and C++ So you decided on a language that makes it even harder to find experienced developers?

it is arguable that C++ in the modern days is no longer "one language" due to style, libraries, language features and code-base legacy; you have to find a coder that will fit your C++ world, not just C++

Just like it will happen to Rust when it achieves 30 years of history, getting features every six weeks.

How many epochs will exist in 30 years?

Re: Rewriting a high performance vector database in Rust

#96
post #3

> First of all, Python is a garbage collected language, which means it can be extremely slow for writing anything high performance at scale. I don't think garbage collection is in the top 3 causes of why Python is slow.

> First of all, Python is a garbage, which means it can be extremely slow for writing anything high performance at scale.

Fixed it.

Re: Rewriting a high performance vector database in Rust

#97
post #79
post #57

Earlier quoted context omitted.

It takes longer to learn how to use C++ to the same level of proficiency and correctness compared to Rust, in my experience. It's harder to write an incorrect program in Rust.

What are the main correctness risks in C++ if you just never use a raw pointer?

I don't know about "main", but like, you don't need raw pointers to have UB. uniq_ptr is nullptr after you move it.

And even then, my understanding is that raw pointers are still intended to be used in Modern C++: they're there for when you don't want to transfer ownership.

Re: Rewriting a high performance vector database in Rust

#98

> If you’re using a higher level language, you’re not going to have access to how the memory is laid out. A simple change, like removing indirection in our list, was an order of magnitude improvement in our latencies since there’s memory prefetching in the compiler and the CPU can anticipate which vectors are going to be loaded next in order to improve the memory footprint. This is a common experience and I'm still s…

Because it is a fake dichotomy.

D, Nim, C#, Swift, not to count all of those that existed since Xerox PARC days.

Re: Rewriting a high performance vector database in Rust

#99
post #84

Earlier quoted context omitted.

"But this also comes with costs: everyone needs to be fairly good at two languages, and switch back and forth." Why does everyone needs to be good at both languages? You can seperate and have the core people writing efficient low level code - and you have higher level scripting/gluing code.

You will have Conway's law in your codebase. Coordination between teams is hard, so teams will prefer to implement features entirely in their language, even where that is technically suboptimal. You will get hot loops in Python, because a Rust programmer wasn't around, and Rust programmers implementing whole complex business logic in Rust behind a single `do_it()` Python call.

Communication and coordination is surely hard and things like that surely happen, but this is why project management exist.

If it is doing things right, then the rust people don't do complex buisness logic, because it is not assigned to them and they would not even have the details.

And if the python people were too eager and have core stuff implemented and it is affecting performance, than you can always reimplement it low level.

It all depends on the project of course, of what would be the best mix.

Re: Rewriting a high performance vector database in Rust

#100
post #67

Earlier quoted context omitted.

This is just plain false. C++ in the 1990s had nothing like serde for example.

And? A drop in the ocean of libraries.

And virtually no one should be starting new projects in C++ and everyone should switch to Rust.
Post reply on HN