jpardogo / PagerSlidingTabStrip

An interactive indicator to navigate between the different pages of a ViewPager
2.19k stars 353 forks source link

Performance Issues #47

Closed VitalikL closed 9 years ago

VitalikL commented 9 years ago

For some reason this implementation is very very laggy in comparison with original astuetz/PagerSlidingTabStrip. Following setup will reproduce the issue:

  1. Main activity layout is DrawerLayout with Fragments being loaded to the ViewPager's manager
  2. Add more than 5 pages to the pager
  3. Each fragment has ScrollView as the root element and couple more views inside (ex. create a simple View with 500dp height)

Swiping and scrolling loses frames, which is not the case when using original lib.

jpardogo commented 9 years ago

Can you explain and report in detail the performance issues you have? Does anybody else have performance issues with this library?

xDragonZ commented 9 years ago

@VitalikL What happen if you add this? mPager.setOffscreenPageLimit(3);

http://stackoverflow.com/questions/21322207/how-does-setoffscreenpagelimit-improve-viewpager-performance-by-retaining-more

r0adkll commented 9 years ago

I too am having performance issues with this library. I have set .setOffscreenPageLimit(3); to no avail.

I'm adding about 365 items to my ViewPager and removing the PagerSlidingTabStrip makes the view pager smooth.

Kev1000000 commented 9 years ago

I am also having performance issues. It seems the GPU is doing a lot in the "process" (orange) step during profiling with this view added to the hierarchy. When you take it out, that large "process" time goes away.

VitalikL commented 9 years ago

@xDragonZ Tried with this setting as well. Does not do anything different.

jpardogo commented 9 years ago

This could be the problem....

Kev1000000 commented 9 years ago

Nice find! Just so you're aware, this is the result of the GPU profiler, with just the tabs enabled. Something is definitely pegging the GPU hard.

http://i.imgur.com/MZ1j8BN.png

yolapop commented 9 years ago

I'm having issue with this too.. what is the solution? There doesn't seem to be setAlpha anywhere in the code.

Thanks.

Kev1000000 commented 9 years ago

Are you planning on fixing this, or should we look for a separate lib?

yolapop commented 9 years ago

@Kev1000000 you can actually fix this yourself, just remove the View.setAlpha method and set the color. (as I did in here, https://github.com/yolapop/PagerSlidingTabStrip - i forgot if I added an text color attribute or not, but I could set inactive text color with ARGB color)

csbenz commented 9 years ago

@yolapop Thanks for making the code modifications! Could you make a pull request so @jpardogo can merge with this library?

EDIT: I'm asking this on behalf of those of us using gradle :)

yolapop commented 9 years ago

Hi sorry for the delay, I just created a PR. https://github.com/jpardogo/PagerSlidingTabStrip/pull/66