-
Notifications
You must be signed in to change notification settings - Fork 326
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
Wip/wdanilo/widgets 182746060 #3678
Conversation
d005648
to
2c3ea11
Compare
…nso into wip/wdanilo/widgets-182746060
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't read everything yet; this is Part 1.
app/gui/view/graph-editor/src/component/breadcrumbs/breadcrumb.rs
Outdated
Show resolved
Hide resolved
app/gui/view/graph-editor/src/component/breadcrumbs/project_name.rs
Outdated
Show resolved
Hide resolved
@kazcw thanks so much for the review. Good comments. Many of these fixmes were left for my next PR - they should be marked as such. Multiple other PRs are blocked by this PR and this is long overdue, so I'll merge it, I'll apply all these comments in the upcoming PR, and I'll ping you there. I hope this is OK? |
@kazcw I applied these comments. Please make rest of the review and I'll apply it in the next PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part 2/3; a few files left to look at tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part 3/3.
Besides the comments below, I've noticed that in a few places we have algorithms that are quadratic (or in one case, O(nm)
) that we could be doing in loglinear time (or in one case, O(n+m)
). That's fine as long as we don't need to handle huge numbers of visible lines, or huge numbers of simultaneous selections. I tried to quantify how far we could scale those factors without getting unacceptably slow, but cargo bench
seems to be broken.
This is a very important observation - could you tell more about the places that you've found, please? I think we should fix them. |
There was a regression introduced by PR #3678 with text synchronization between IDE and the Engine. This PR fixes it. It was reproducible as an error log about version mismatch in a case when the metadata becomes shorter (e.g. on removing node). # Important Notes [ci no changelog needed]
Most users of This case in |
Fix issues noted here: #3678 (comment) - 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.
[ci no changelog needed]
Pull Request Description
This PR introduces several big changes in crucial areas, so it is recommended to every developer carefully read the below changelog.
Global changes (incl. prelude).
Tracing
is our default logger now. Prelude exportswarn!
,debug!
, etc. fromTracing
now. A lot of APIs were refactored to support it.VecIndexedBy<T, I = usize, A: Allocator = std::alloc::Global>
which is likeVec
but usesI
as indexes (instead ofusize
). This allows for building better APIs. TheNonEmptyVec
was modified to support it as well.3.std::Range
extensions were added. Seelib/rust/prelude/src/range.rs
to learn more.define_not_same_trait
macro exported in the prelude. Its implementation is simple:It can be used to disambiguate trait impls. For example, this is not working in Rust:
because it conflicts with std-defined
impl<T> From<T> for T {...}
. Now, you can define it as:Somehow, it does not work if the trait is just defined in the prelude and it has to be defined locally.
FRP changes.
Consider the following definition:
To call it, you can provide arguments with the following types (which will be auto-converted to the expected types):
(TextRange, Option<style::Property>)
(&TextRange, Option<&style::Property>)
(&TextRange, style::Property)
(Range<Ubytes>, style::Property)
impl From<Range<Ubytes>> for TextRange
.TextRange, color::Red)
impl From<color::Red> for style::Property
(automatic conversion fromcolor::Red
toOption<style::Property>
.Changes the animation framework.
In the past, each
animation::Loop
was a separate JS animation loop (constructed withrequestAnimationLoop
under the hood). The problem with this approach is that we do not control the order of the callbacks running and we do not know when they finish. Let's consider this use case - we want to know what is the width of the text area. It can contain multiple cursors in multiple lines, each with animation after glyph insertion. This makes multiple animations of possibly multiple lines that can change the text area width. With the newanimation::Loop
implementation it is possible to run all the animations and then, after they are updated (per-frame), check which line was the longest.Changes in text rendering
Basically, text rendering performance is drastically improved and text now supports any Unicode left-to-right glyphs properly. The text rendering performance will be further improved in the next PR, which will introduce the rendering of multiple text areas in a single render pass.
.ttf
files, and thus, the text area needs to be able to mix different definitions into one abstraction.அட0
. If we insert்
afterட
, then we should getட்
instead ofட
. Moreover, theட்
glyph can have different x-axis dimensions than theட
one. All of this is now supported.UBytes
, orViewLine
in order to indicate that the value can not be negative or is used to describe the scrolled-line index, respectively. This allowed catching multiple bugs in the old implementation.usize
in many places, often wrongly.Fixed bugs
Checklist
Please include the following checklist in your PR:
Scala,
Java,
and
Rust
style guides.
./run ide build
and./run ide watch
.