enso/lib/rust/prelude
Kaz Wesley b58470145c
Widgets: improve scalability in some cases (#3920)
Fix issues noted here: https://github.com/enso-org/enso/pull/3678#issuecomment-1273623924
- Time complexity of an operation during line-redrawing scaled quadratically with number of lines in a change; now linear.
- Time complexity of adding `n` selections to a group was `O(n^2)`. Now it is `O(n log n)`, even if the selections are added one by one.

Also fix a subtle bug I found in `Group::newest_mut`: It returned a mutable reference that allowed breaking the *sorted* invariant of the selection group. The new implementation moves the element to invalidated space before returning a reference (internally to `LazyInvariantVec`), so that if it is mutated it will be moved to its correct location.

### Important Notes

New APIs:
- `NonEmptyVec::extend_at` supports inserting a sequence of elements at a location, with asymptotically-better performance than a series of `insert`s. (This is a subset of the functionality of `Vec::splice`, a function which we can't safely offer for `NonEmptyVec`).
- `LazyInvariantVec` supports lazily-restoring an invariant on a vector. For an invariant such as *sorted* (or in this case, *sorted and merged*), this allows asymptotically-better performance than maintaining the invariant with each mutation.
2022-11-30 13:36:28 +01:00
..
src Widgets: improve scalability in some cases (#3920) 2022-11-30 13:36:28 +01:00
Cargo.toml removing optional dependencies from prelude (#3922) 2022-11-28 12:42:31 +01:00
README.md add rust libs 2021-10-30 02:28:55 +02:00

Enso Prelude

The Enso prelude is a library in the style of the Haskell prelude, pulling in a number of useful foundational features for writing Rust code in the Enso project.