-
Notifications
You must be signed in to change notification settings - Fork 248
feat(dccd):ObservableList / ObservableMap & Observable #1156
Conversation
I have added some more commits to this PR, the latest one has an implementation for field notification. It works in mirrors mode, not in transformed mode yet - there seems to be an issue with the analyzer version required for observe vs the one required for angular, di and some other core pkgs. Next steps:
I would also like to update the code for my 2nd TODO item given in the PR header.
I think this would allow easier testing. |
var subscription = (object as obs.Observable).changes.listen((records) { | ||
for (var rec in records) { | ||
// todo(vicb) Change to String if dartbug.com/17863 eventually gets fixed | ||
if (smoke.symbolToName(rec.name) == field) { |
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.
This does not work on transformed code (it would require to write a custom transformer, the polymer script_compactor could be used as a starting point).
An easy option is to dirty check all fields when a Notification is triggered on an object (we would not get as much as by checking the field).
I have just updated the PR by adding:
The code works. The things left to do:
|
Tests have been added (and yes, that's true, what you don't test is broken) The PR should be ready to go if Travis is happy |
@reflectable @observable int get obs => __$obs; | ||
int __$obs; | ||
@reflectable set obs(v) { | ||
__$obs = v; |
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.
the notification shoule be added here - that's not important but more correct
Some idea to create a benchmark:
Some gotchas:
|
Hi @vicb, I started to debug this with Observatory and added test code that runs one test loop controlled by hitting the key on the keyboard. I am not so firm in Dart and the change detection code to find the problem, could you take a look?
|
@vicb Here is a commit that adds the performance tests you mentioned: tbosch@6b93596 However, as already said, some of them crash with a heap error when used with observables (I commented those out): add/remove WatchGroups and change arrays. |
@tbosch thanks for the benchmark, I'll have a look on next Monday |
@mhevery I have updated Reducing the number of iterations increase the stdev:
|
Ok, regarding the memory problems: For adding/removing groups we need to do a For @vicb Could you add the call to |
@tbosch is the last "fixup" commit what you need ? The commit "Update _perf to prevent heap overflow" is still required to prevent memory errors after that. |
I have updated the PR to remove all the things related to smoke and to add an important comment:
|
There hasn't been much activity on this PR. @vicb is it blocked on something? What are the next steps? It looks like we should have the Dart team tackle that observe dependency problem, though, yes? It looks like the observe package was just updated last week, so we are probably good to go.. |
The PR is ready (some commits should be squashed). There is still an "issue" with the dependencies as observe which is required by this PR depends on a very recent version of analyzer. Angular and di depends on an older version, this we can fix. However some core pkgs (Intl, ...) also depends on an older version. Getting the dart team to publish a changelog for the analyzer and to make sure that the core pkgs are compatible (dependency wise) would really help. However if the analyzer keeps breaking BC (I think the latest version is now 0.18) there is nothing much we can do. (Users are starting to complain about this dependency issue). If we merge this PR as it is, users will have to add an override in their pubspec. |
@mhevery Could you please double-check chore(_perf.dart): lower the target time to prevent a memory overflow - we had to lower the target time to prevent a memory overflow (due to a bug in Dart). If you're ok with this update, the PR is rebased and can be merged |
…ifier Lower the target time to prevent a memory overflow. Benchmark added. Fixes dart-archive#773 Closes dart-archive#1156
8fd235c
to
50e2645
Compare
…ifier Lower the target time to prevent a memory overflow. Benchmark added. Fixes dart-archive#773 Closes dart-archive#1156
…ifier Lower the target time to prevent a memory overflow. Benchmark added. Fixes dart-archive#773 Closes dart-archive#1156 Closes dart-archive#1466
…ifier Lower the target time to prevent a memory overflow. Benchmark added. Fixes dart-archive#773 Closes dart-archive#1156
…ifier Lower the target time to prevent a memory overflow. Benchmark added. To use annotate your models with @observable or use ObservableList or ObservableMap. Fixes dart-archive#773 Closes dart-archive#1156
…ifier Lower the target time to prevent a memory overflow. Benchmark added. To use annotate your models with @observable or use ObservableList or ObservableMap. Fixes dart-archive#773 Closes dart-archive#1156
…ifier Lower the target time to prevent a memory overflow. Benchmark added. To use annotate your models with @observable or use ObservableList or ObservableMap. Fixes dart-archive#773 Closes dart-archive#1156
I thought this was merged. No? |
@rkirov has a rebased version, there were some problems that should be fixed now. |
…ifier Lower the target time to prevent a memory overflow. Benchmark added. To use annotate your models with @observable or use ObservableList or ObservableMap. Fixes dart-archive#773 Closes dart-archive#1156
…ifier Lower the target time to prevent a memory overflow. Benchmark added. To use annotate your models with @observable or use ObservableList or ObservableMap. Fixes dart-archive#773 Closes dart-archive#1156
Rebased and will be merged as #1419 |
…ifier Lower the target time to prevent a memory overflow. Benchmark added. To use annotate your models with @observable or use ObservableList or ObservableMap. Fixes #773 Closes #1156
…ifier Lower the target time to prevent a memory overflow. Benchmark added. To use annotate your models with @observable or use ObservableList or ObservableMap. Fixes #773 Closes #1156
For now this is a first batch of changes for Observable support to use notifications for
ObservableList
&ObservableMap
Things missing from this PR:
The code is not expected to change so the PR is ready for review (only tests should be added)
Next steps (further PRs):