Skip to content

Noob question: performance tradeoffs vs. the MLStyle approach to sum types #43

Answered by MasonProtter
lukemerrick asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @lukemerrick, sorry for the slow response. Yes, I think your summary / understanding is more or less accurate, though I don't really count MLStyle.jl's @adt types as real sum types. As you point out, they're actually just syntactic sugar for subtyping and union splitting.

Regarding your sub-questions

  • Are the structs defined by SumTypes fixed size no matter which conceptual type they represent, or does their generic typing afford flexibility there?
    • If so, does that trade off potentially higher memory usage?
    • If so, does it enable performance wins for things like an Array, since indexing is simpler?
    • If not, does that trade off performance for things like Arrays?

SumTypes storage si…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@lukemerrick
Comment options

@MasonProtter
Comment options

@MasonProtter
Comment options

Answer selected by lukemerrick
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #29 on June 09, 2023 20:52.