apca icon indicating copy to clipboard operation
apca copied to clipboard

Proposal: Use a dedicated data type for stock symbols instead of String

Open vultix opened this issue 2 years ago • 2 comments

Proposal: Use a stack-allocated dedicated Symbol type such as stock-symbol.

Benefits:

  • A dedicated type is more self-explanatory than passing around strings
  • Should be much faster than doing many tiny heap allocated String symbols
  • This will allow us to implement Copy, making many operations much simpler
  • Can provide additional validation of the underlying strings

vultix avatar May 02 '23 21:05 vultix

I'd be willing to make a pull request if this is the way we want to go

vultix avatar May 02 '23 21:05 vultix

Thanks for bringing this up. Yeah, it probably makes sense to introduce such a type. But I'd suggest we define it ourselves instead of relying on a third-party crate such as stock-symbol. Could probably be as simple as a wrapper around [7; c_char] or something like that. Feel free to propose an implementation or prototype something.

d-e-s-o avatar May 04 '23 00:05 d-e-s-o