-
Notifications
You must be signed in to change notification settings - Fork 13
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
move svg position of helices out of design and into view #650
Comments
Alternately, remove Helix SVG position from the BUT, test editing a very large design (especially one with many helices, like hundreds of helices) to see if this slows things down, to have that much data computation happening in the render logic. |
Initially, we were thinking that we could compute the svg position at the level of DesignMainHelices. However, it turns out nearly many other components in DesignMain also depend on svg position, which they access by calling the @dave-doty any thoughts on the refactor or other suggestions? |
Hopefully we can calculate all the SVG positions in DesignMain and then pass them as props (e.g., as a Map mapping Helix idx's to SVG positions, where you only populate with the necessary helices (e.g., for DesignMainStrand, only give the helices where the strand resides). Does that seem straightforward? (Not sure if it is or not.) |
This idea should work, although i think it's unnecessary to worry about which helices are actually necessary and instead simply pass in the entire map of helix idx to SVG positions without worrying about which ones are actually needed. Seems straightforward enough, just might be a lot of busy work with number of usages of svg_position. I will let you know if I run into any issues. |
Upon further thought, I realize that we should narrow down which helices are needed for each specific component in order to prevent unnecessary rendering from React. I'll need to look into the code some more to see if this will be straightforward. |
Update: I have completed refactoring all usages of I believe that we need to call the new |
Hmm, this is definitely a serious issue I hadn't foreseen. I don't think computing all SVG positions in every event listener is good. I don't want to do pre-mature optimization, but some of these are called very often, e.g., the slice bar movement. Here's one idea.
If there's some way to re-structure the AppState so that the Helix SVG positions are somehow a memoized field of some class that does contain the relevant data, then it could be automatically re-calculated by the Built library. However, I don't see how to do this since SVG position depends on so many disparate things, including UI state like So I'm not sure what exactly to do for now. Open to other ideas. |
Could we make a new memoized field |
Sure, let's give that a shot. I'm worried about the potential performance, but let's just try it and test it on the large example design. |
That was, for instance, dispatching an action such as
InvertXYSet
, which does not change anything about the design that would get stored in the.sc
file, will not change the DartDesign
object and cause a warning about changing theDesign
with a non-UndoableAction
action.The text was updated successfully, but these errors were encountered: