Conversation
|
|
||
| bus: Vue; | ||
| /** A callback to notify about changes to the track. */ | ||
| notifier?: TrackNotifier; |
There was a problem hiding this comment.
Looking at this now is it necessary for each Track to have it's own notifier. Could it be a static property and setNotifier be a static method that is assigned once for the entire class? setNotifier is always setting the same function to each track which depends on the function passing in it's own values into it? This would remove the need to unset the notifier from removed tracks because they no longer exist? I guess the worry would be that some track after calling removeTrack still calls a notify even though it isn't in the trackMap? Let me know if there are things I haven't thought of and counter examples.
There was a problem hiding this comment.
After thinking about it, I don't think we should make it a static class method. Looking ahead to stereo or multi-camera views, we may need to be able to differentiate between the event sourcees.
The property is just a pointer, so it costs almost nothing in memory for each track to hold a reference (8 bytes for a pointer).
So for 100K tracks, we're talking 800KB.
BryonLewis
left a comment
There was a problem hiding this comment.
The justification for future usage is enough to keep it as is. I vaguely thought that there may be a need for multi-stereo but had not fully thought it out.
Removes a Vue instance from each track instantiation, replace with a simple callback function.
Profile results
With 100K tracks and 20 types on 20 image frames
App uses 80MB of memory with no tracks at idle, so this results in about a 50% reduction in dynamic memory usage.