cksac/dataloader-rs

What's the reason BatchFn::load returns a HashMap instead of a Vec?

Opened this issue · 1 comments

That's pretty much what the reference implementation does: https://github.com/graphql/dataloader/tree/90353d8d34063f92c7c6300d66d0e9ce0a8d51c4#batch-function.

Indexing into a HashMap is notoriously slower than indexing into a Vec. On top of that, Rust, by default, uses a computationally expensive hashing algorithm.

But yeah, that'd be a breaking change for end users.

cksac commented

Vec required the result same order as input keys which I think is harder than HashMap for users. So that I decided not following js implementation. Maybe the lib can enhance to allow user to use another hash algorithm would address who need more performance.