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

Serdes are slow #4

Open
hughsimpson opened this issue Jun 6, 2021 · 2 comments
Open

Serdes are slow #4

hughsimpson opened this issue Jun 6, 2021 · 2 comments

Comments

@hughsimpson
Copy link
Owner

Really we shouldn't have any problems decoding and re-encoding the FHIR definitions in like a second, but it takes ages.

@alabamenhu
Copy link

Glancing over the code base a few things jump out at me:

  • subsets require runtime checking. A lot of your subsets are just creating an alias subset Foo of Bar { } is export, but it ends up slowing down potential optimizations. Two ways you could speed up this style of aliasing would be constant Foo = Bar (but now type error messages will complain about Bar, rather than Foo, doesn't seem like that'd be too much of a hassle for you), and class Foo is Bar { }. The constant route is probably a teensy bit faster depending on exactly how MRO happens, but the latter will give you flexibility if you later need to provide deeper introspection on the elements or do more substantial checks on creation.
  • In the JSON part, you have two of the biggest performance killers: large given/whens, and mixins. For the former, if you're going to be matching on strings, a way that can vastly improve performance is to use hashes:
    my constant %when = 
        a => { … }, 
        b => { … };

    with %when{$given} { .()         }
    else               { #`[default] }

@hughsimpson
Copy link
Owner Author

Yeah the current mixins are an obvious candidate for performance improvements. I don't think the givens are even showing up yet, performance-wise, TBQH. I haven't had the time to revise this really, it was just a little test for some code-generation work that I decided to pretty-up enough to be technically usable, I don't use Raku in my day-to-day and don't know the language awfully well

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

No branches or pull requests

2 participants