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

Compare performance between data types used for Price #10

Open
minicheddar opened this issue Jan 5, 2023 · 0 comments
Open

Compare performance between data types used for Price #10

minicheddar opened this issue Jan 5, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@minicheddar
Copy link
Owner

Rust does not allow ordering of f32/f64s as part of std. This prevents using f64 as a key in BTreeMap<f64, OrderbookLevel>.

For now, we should just use this (https://crates.io/crates/ordered-float), but I'm curious on the performance difference between.

  • Implementing PartialOrd for floats as above
  • Having serde deserialise 'float-like' data straight to Decimal
  • Having serde deserialise to f64, but converting to Decimal when returning MarketDataKind:L2Update/Snapshot
  • Storing prices as u64 with a mantissa on the number of floating points as a separate piece of metadata (like smart contracts)

This is definitely a low-priority premature micro-optimisation!

@minicheddar minicheddar added the enhancement New feature or request label Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant