linebender / parley

Rich text layout library
Apache License 2.0
229 stars 28 forks source link

Eliminate extraneous allocation and dynamic dispatch in `PlainEditor` #154

Closed mwcampbell closed 3 weeks ago

mwcampbell commented 3 weeks ago

I started by wanting to eliminate Arc<str>. Then I noticed that vello_editor was allocating temporary Vecs for the PlainEditorOps. Finally, it occurred to me that we could probably do something altogether more efficient than PlainEditorOp. I think my refactored version, with separate functions in PlainEditorTxn, will be nicer to maintain as well.

xorgy commented 3 weeks ago

Thanks, this looks great. I'll give it a quick check. This is basically exactly what I planned to do (the enum thing was a mistake anyway).