Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Help] Does the FST file format work cross-platform? #151

Open
akprasad opened this issue Oct 26, 2022 · 1 comment
Open

[Help] Does the FST file format work cross-platform? #151

akprasad opened this issue Oct 26, 2022 · 1 comment
Labels

Comments

@akprasad
Copy link

akprasad commented Oct 26, 2022

First, thank you for this marvelous library. I'm experimenting with fst for my first ever Rust project, and for my use case, fst provides 10x the compression of gzip with a minimal lookup penalty at runtime.

My question is: does the .fst file created by MapBuilder work across platforms? Ideally I could generate this file just once on my Macbook then distribute it across all of the platforms I want to support: Linux x64, Wasm, ...

I checked the docs, but I couldn't find a clear answer to this question. But then again, I'm a Rust newbie who's fairly new to systems programming, so perhaps there's an obvious answer I'm just not aware of.

Thank you for your time!

(PS: I'm not sure what the right forum is for help questions, so forgive me if I'm in the wrong place.)

@BurntSushi
Copy link
Owner

Yes. If it weren't cross platform, then there would be different functions for serializing the FST, like how regex-automata has both big-endian and little-endian serialization routines: https://docs.rs/regex-automata/latest/regex_automata/dfa/dense/struct.DFA.html#impl-3

For FSTs though, endianness is always explicitly specified when reading and writing, so there aren't any platform incompatibility issues. To be clear, the exact same byte-for-byte FST can be used on any platform, regardless of endianness or anything else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants