Skip to content

Conversation

tecosaur
Copy link
Member

@tecosaur tecosaur commented Mar 9, 2024

In JuliaLang/julia@f117a500ca93, the AnnotatedIOBuffer type was introduced. If you write from an AnnotatedIOBuffer to another kind of IO, currently all styling information is lost.

This seems undesirable, and we can make it work more like writing an AnnotatedString to IO ... by converting this to an AnnotatedString write within a specialised write method.

The conversion surely adds overhead, but it's a very staightforward way to make this work. If this ends up being a legitimate performance concern, we can always revisit this and either:

  • Add a specialised code path for AnnotatedIOBuffer
  • Try to make the current AnnotatedString-oriented methods more
    generic (somehow)

The utility of this was first expressed in JuliaLang/julia#51928 (comment)

cc: @vtjnash

In JuliaLang/julia@f117a500ca93, the
AnnotatedIOBuffer type was introduced. If you write from an
AnnotatedIOBuffer to another kind of IO, currently all styling
information is lost.

This seems undesirable, and we can make it work more like writing an
AnnotatedString to IO ... by converting this to an AnnotatedString write
within a specialised write method.

The conversion surely adds overhead, but it's a very staightforward way
to make this work. If this ends up being a legitimate performance
concern, we can always revisit this and either:
- Add a specialised code path for AnnotatedIOBuffer
- Try to make the current AnnotatedString-oriented methods more
  generic (somehow)
@tecosaur tecosaur force-pushed the annotatediobuffer-specialisation branch from 3c16ae5 to 11c5bd9 Compare March 13, 2024 09:07
@tecosaur
Copy link
Member Author

Since this has already been requested, is fairly straightforward, and now has tests, I'll go ahead and merge this.

@tecosaur tecosaur merged commit 11c5bd9 into main Mar 13, 2024
@tecosaur tecosaur deleted the annotatediobuffer-specialisation branch March 13, 2024 13:57
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

Successfully merging this pull request may close these issues.

1 participant