Sluggish performance on Android 4.4 - ion-slide-box with ng-repeat and content heavy slides - new nightly
I was hoping the new nightly would increase the performance of this but it seems no different. I'm generating 4 slides of news entires with ng-repeat. Each slide is quite content heavy in terms of HTML. The sliding and scrolling within each slide is really sluggish and stop/start on Android, to the point it feels horrible to use. Would adding the slides dynamically help this? Any other suggestions?
How many slides are you initially loading at once? It may just be the initial DOM compile time that's lagging you down.
The reason we can't virtualize the DOM like in collection repeat is because slides could be arranged in any of a million ways... For example:
<ion-slide-box>
<ion-slide ng-if="something">Hello</ion-slide>
<ion-slide ng-repeat="abc in items"></ion-slide>
<ion-slide>Always here</ion-slide>
<div ng-if="bananas">
<ion-slide ng-if="monkeys">Monkeys?</ion-slide>
<ion-slide>Whatever.</ion-slide>
</div>
</ion-slide-box>
Also, I'm going to add an on-slide event which will fire when an animation starts.
I'm loading 4, it must be that compile time. I'll need to try and refactor I guess. That on-slide event sounds handy.
Only four slides should be fine. How long of a delay are you talking about?
On Mon Dec 01 2014 at 3:07:21 PM Ollie Kavanagh [email protected] wrote:
I'm loading 4, it must be that compile time. I'll need to try and refactor I guess. That on-slide event sounds handy.
— Reply to this email directly or view it on GitHub https://github.com/driftyco/ionic/issues/2578#issuecomment-65143521.
At least a second, coupled with the white screen. I get the same delay with Angular Carousel, but a smoother page load and no white flash so it doesn't feel as odd. I'm trying to debug it but I can't work out why it's happening. Even if I remove the setting of the active slide for both it still happens so must be the initial compile of the respective carousels. I'll see if I can get you some more information.
How complicated are your carousels? Is there something else huge being loaded?
The new slidebox introduces breaking changes for me - I have a simple set of ion-slide elements that get generated dynamically according to how many images I get back from the server, and use an image per slide. I had the ion-slide elements set to display: flex and did some vertical and horizontal alignment via flexbox attributes - the change to display: inline-block caused a lot of havoc, and it is looking quite difficult to get this fixed.
I can either work with the inline-block elements and hack together a fix that does not have vertical alignment, or I can use flexbox and have weird behavior where every slide after the second one flashes into the first slide displayed even though the correct slide is seen. :(
It's mostly text HTML content, one image. It's all JSON which I load through a service. We do run through a fair amount of conditions to show the content, mainly ng-if on blocks just to check if the value exists. I'll try some refactoring and see if I get any improvements.
@wesleycho I made the selector for display less specific and used display: block.
Try setting your selectors to this:
.slider-slide[slide-display='selected'] {
display: flex;
align-items: center;
justify-content: center;
}
OK, nevermind. @wesleycho Try the nightly build with your current CSS and it should work now.
It now sets display: none !important if the slide is hidden. Otherwise it will default to block, but it's a very easily overridable selector (tag-level, not class-level).
I added the !important flag because it lets the end-developer specify displays for slides as specifically as he wants, but still not show the slides that should be hidden.
@olliekav on-slide-start is up. http://ionicframework.com/docs/nightly/api/directive/ionSlideBox/
I ended up coming up with a similar fix, although I also set next and previous to display: flex as well.
ion-slide {
display: none;
&[slide-display="selected"], &[slide-display="next"], &[slide-display="previous"] {
display: flex;
}
}
If you get rid of that, you should just be able to do:
ion-slide {
display: flex;
}
Because internally, we now do:
ion-slide {
&:not([slide-display]) {
display: none !important;
}
}
Hi,
I also ran into this performance issue. I can confirm that the latest (nightly) build solved it. Great work guys!!
--dre
btw I tested my app on a iphone 3
Awesome! Closing this.
I'm not sure if I should open a new ticket, but it seems to be related. With around 200 slides (using ng-repeat) of simple text content, the compile time is unbearable. I also have to trigger $ionicSlideBoxDelegate.update(); after another 1 or 2 seconds otherwise my content won't render properly (it is in a very narrow block to the very left, before it jumps into place after $ionicSlideBoxDelegate.update(); is called).
@ajoslin Just curious why the latest versions dropped this method...
ion-slide {
&:not([slide-display]) {
display: none !important;
}
}
Seems its been left behind in favor of using translates. I think it was faster before. when you were hiding all but the 3 (prev, curr, next). [slide-display] is gone.
Same issue with the rc-0 for me. (cc @johannesjo)
I'm wondering if we could have a callback on $ionicSlideBoxDelegate.update();?
Florent
http://nmr.co.ke/schet_roboforex
13.03.2015, 15:17, "Florent Suc" [email protected]:Same issue with the rc-0 for me. (cc )
I'm wondering if we could have a callback on $ionicSlideBoxDelegate.update();?
—Reply to this email directly or .