-
Notifications
You must be signed in to change notification settings - Fork 3.4k
perf(autocomplete): Use virtual repeat... #3733
Conversation
I gathered some numbers (All in ms) from the chrome profiler testing dist/demos/autocomplete/demoBasicUsage/index.html, which has 50 repeated items. I'd expect that with a larger data set (say hundreds of items or more), the times would diverge by a lot more. Startup times: ctrl.matches (which feeds the repeater) is not populated yet, so we shouldn't expect much change until the user starts typing... Time to click into textfield and type "aaa": |
@@ -178,14 +178,18 @@ md-autocomplete { | |||
} | |||
} | |||
} | |||
|
|||
.md-autocomplete-suggestions-container { | |||
position: absolute !important; |
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.
Can we do this without using !important
? I doubt it matters in this case, but if possible, it'd be nice.
LGTM |
$$rAF.flush(); | ||
element.scope().$apply(); | ||
$$rAF.flush(); | ||
}); |
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.
So, I think I get it: You just have to scope.$apply()
, then $timeout.flush()
, then $$rAF.flush()
, then again scope.$apply()
, then finally $$rAF.flush()
again and...BAM...virtual-repeat ready !!!
Nice !
(Some comments would be also nice here, but I guess that's not very straightforward.)
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.
LOL - completely obvious.
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.
as @gkalpak says, the code is 100% self-documenting and not confusing at all.
However, I've added some comments as well.
8705488
to
9af95cd
Compare
@kseamon - please rebase and I can merge. |
9af95cd
to
99a51c0
Compare
Rebased |
@jelbourn This is failing due to tests relating to Calendar, can you take a look and help me merge this in tomorrow? |
It's probably because calendar tests need to do the same sequence of flushes / applies. |
@robertmesserle, @jelbourn - tests still failing: Firefox 31.0.0 (Mac OS X 10.9.0) md-calendar calendar construction should highlight the selected date FAILED
Error: [$compile:ctreq] Controller 'mdCalendar', required by directive 'mdCalendarMonth', can't be found!
http://errors.angularjs.org/1.4.4/$compile/ctreq?p0=mdCalendar&p1=mdCalendarMonth in /Users/thomasburleson/Documents/projects/Google/projects/material/node_modules/angular/angular.js (line 68)
minErr/<@/Users/thomasburleson/Documents/projects/Google/projects/material/node_modules/angular/angular.js:68:5
getControllers@/Users/thomasburleson/Documents/projects/Google/projects/material/node_modules/angular/angular.js:8105:1
getControllers@/Users/thomasburleson/Documents/projects/Google/projects/material/node_modules/angular/angular.js:8110:13
nodeLinkFn@/Users/thomasburleson/Documents/projects/Google/projects/material/node_modules/angular/angular.js:8250:1
compositeLinkFn@/Users/thomasburleson/Documents/projects/Google/projects/material/node_modules/angular/angular.js:7638:1
publicLinkFn@/Users/thomasburleson/Documents/projects/Google/projects/material/node_modules/angular/angular.js:7512:30
createBoundTranscludeFn/boundTranscludeFn@/Users/thomasburleson/Documents/projects/Google/projects/material/node_modules/angular/angular.js:7659:11
controllersBoundTransclude@/Users/thomasburleson/Documents/projects/Google/projects/material/node_modules/angular/angular.js:8273:11
VirtualRepeatController.prototype.getBlock_@/Users/thomasburleson/Documents/projects/Google/projects/material/src/components/virtualRepeat/virtualRepeater.js:630:3
VirtualRepeatController.prototype.virtualRepeatUpdate_@/Users/thomasburleson/Documents/projects/Google/projects/material/src/components/virtualRepeat/virtualRepeater.js:581:5
bind/<@/Users/thomasburleson/Documents/projects/Google/projects/material/node_modules/angular/angular.js:1185:1
$watchCollectionAction@/Users/thomasburleson/Documents/projects/Google/projects/material/node_modules/angular/angular.js:15618:13
$RootScopeProvider/this.$get</Scope.prototype.$digest@/Users/thomasburleson/Documents/projects/Google/projects/material/node_modules/angular/angular.js:15753:23
$RootScopeProvider/this.$get</Scope.prototype.$apply@/Users/thomasburleson/Documents/projects/Google/projects/material/node_modules/angular/angular.js:16024:13
applyDateChange@/Users/thomasburleson/Documents/projects/Google/projects/material/src/components/datepicker/calendar.spec.js:19:5
@/Users/thomasburleson/Documents/projects/Google/projects/material/src/components/datepicker/calendar.spec.js:243:7 |
...and some other optimizations review
99a51c0
to
6763327
Compare
@ThomasBurleson @jelbourn Updated - Tests are fixed |
Autocomplete with custom template is not work properly after this commit even at: https://material.angularjs.org/HEAD/#/demo/material.components.autocomplete |
...and some other optimizations Closes angular#3733.
...and some other optimizations