Skip to content

Refactor the code to use modern Rust #11

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

Closed
zbraniecki opened this issue Sep 6, 2019 · 1 comment
Closed

Refactor the code to use modern Rust #11

zbraniecki opened this issue Sep 6, 2019 · 1 comment
Assignees

Comments

@zbraniecki
Copy link
Contributor

Since we now have interest from https://github.com/brendanzab/codespan and https://github.com/wycats/language-reporting to merge them into annotate-snippets, I'd like to put some effort into cleaning up the internals of this crate.

There are two levels on which we can work:

  1. We can provide some basic impl methods for our structs/enums.

The reasons here would be to make creating snippets/slices easier, and to allow for data validation during snippet/slice creation. For example, we could then validate that an annotation vector fits into slice scope.

  1. We can clean up the internal logic.

A lot of the internal code is suboptimally written and not fully performant.

I'm not sure how/if/when I'd like to tackle the (1), since I'm not sure how much value there is to duplicate the validation which must happen anyway during slice->displaylist creation. I certainly would like to avoid performing the same logic twice.
So maybe it's ok that you construct the Slice which may be bogus, and then when you convert it to display list we can error out if your slice pointers make no sense.

We can think about it more.

But I certainly would like to clean up the inner guts to reduce memory usage and boost perf. I started playing with it, and am getting a nice ~10x perf boost so I'll continue working on the cleanups. The cleanups should not affect the API except of things like zero-copy.

@epage
Copy link
Contributor

epage commented Mar 13, 2024

As this is general ideas, I'm going to close. We can create more specific issues as we identify ways the code can be cleaned up.

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2024
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