HabitRPG / habitica

A habit tracker app which treats your goals like a Role Playing Game.
https://habitica.com
Other
11.95k stars 4.08k forks source link

Running very slow in Chrome #3486

Closed leephon closed 8 years ago

leephon commented 10 years ago

When I run HabitRPG in Chrome (Version 34.0.1847.137 m), my preferred browser, it runs extremely slow (2-10 seconds before clicks get responses, especially bad on inventory and chat pages). This is particularly aggravating while typing in a chat box. The cursor stops and takes several seconds to start again, though it usually gets all that I typed. To me, this makes it unusable. Fortunately, it's running fine in Firefox (29.0.1).

UUID 8715b971-500b-4e81-a445-0196eb3ef5cb

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

deilann commented 10 years ago

Oooh, it's running fine on Firefox? It runs terribly for me in Chrome as well. I wonder if switching to FF would help.

On Sun, May 18, 2014 at 9:09 AM, leephon notifications@github.com wrote:

When I run HabitRPG in Chrome (Version 34.0.1847.137 m), my preferred browser, it runs extremely slow (2-10 seconds before clicks get responses, especially bad on inventory and chat pages). This is particularly aggravating while typing in a chat box. The cursor stops and takes several seconds to start again, though it usually gets all that I typed. To me, this makes it unusable. Fortunately, it's running fine in Firefox (29.0.1).

UUID 8715b971-500b-4e81-a445-0196eb3ef5cb

— Reply to this email directly or view it on GitHubhttps://github.com/HabitRPG/habitrpg/issues/3486 .

deilann commented 10 years ago

Sigh. Nope. It's running worse in FF. Even more unresponsive script errors.

On Sun, May 18, 2014 at 9:11 AM, Ryan yandoryn@gmail.com wrote:

Oooh, it's running fine on Firefox? It runs terribly for me in Chrome as well. I wonder if switching to FF would help.

On Sun, May 18, 2014 at 9:09 AM, leephon notifications@github.com wrote:

When I run HabitRPG in Chrome (Version 34.0.1847.137 m), my preferred browser, it runs extremely slow (2-10 seconds before clicks get responses, especially bad on inventory and chat pages). This is particularly aggravating while typing in a chat box. The cursor stops and takes several seconds to start again, though it usually gets all that I typed. To me, this makes it unusable. Fortunately, it's running fine in Firefox (29.0.1).

UUID 8715b971-500b-4e81-a445-0196eb3ef5cb

— Reply to this email directly or view it on GitHubhttps://github.com/HabitRPG/habitrpg/issues/3486 .

leephon commented 10 years ago

This is the last week or so for me. I did get one unresponsive script error in FF I think yesterday, but I failed to save the number.

leephon commented 10 years ago

Whoops

Sardtok commented 10 years ago

It's horribly slow for me in FF, which is my preferred browser, but I do have a lot of developer add-ons, which might be partly to blame.

The worst is the chat interface as described by leephon.

But also other parts. Like if I click a daily to check it, then scroll down or move the mouse pointer, a different daily will be checked instead. This last part is not just a performance issue, but a bug. From the behaviour, it seems the position of the mouse is checked upon handling the event, instead of checking what the target of the event was.

BuntonArt commented 10 years ago

I am experiencing the same issue. It is almost unusable in Chrome as well as Firefox. Even the text entry field in the tavern takes around 10 seconds for any text to display.

MinatureCookie commented 10 years ago

Same issue here. Typing in the tavern is effectively impossible. My entire inventory is effective unusable with delay.

Not getting any console errors, in Chrome (my default browser). Running it in Firefox runs smoothly.

I've tried clearing all browsing data, and re-loading Habit, but no dice.

thepeopleseason commented 10 years ago

Two potential workarounds: I seem to recall that clearing completed tasks was mentioned as a performance helper.

Also, can you list how many people are in your party? @lefnire has previously stated that too many party members can slow the performance of HabitRPG tremendously.

MinatureCookie commented 10 years ago

@thepeopleseason Sorry I should have mentioned these.

My party size is only 3, and all tasks are cleared. Neither of those cause.

ProLoser commented 10 years ago

What are your character names and do you have an extremely high number of something on your account (# of tasks, # of friends, # of whatever, etc). This is a performance issue with AngularJS in all likeliness.

MinatureCookie commented 10 years ago

Mine is MinatureCookie.

I don't think this is just an AngularJS performance issue. Nothing on my account has changed, but with the most recent update (or, at least, at a similar time) Habit very suddenly became entirely unusable.

The largest number of anything that I have is 8 dailies. But again, this has been this way since months back. The problems have just started a few days ago.

ampatalas commented 10 years ago

I'm experiencing the same problem. HabitRPG became almost unusable in Chrome (34.0.1847.137 m). My regular account is quite old, lvl 40, a lot of tasks and pets, 9 party members. I tried setting up new account, goes somewhat smoother, but still slow, especially when it comes to chats, switching between pages, and showing and closing help pop-ups (such as description of eggs and portions in Inventory). I tested it out today on Firefox (29.0.1) and everything seemed to work fine.

dankrubis commented 10 years ago

Same thing happening to me in chrome. I have a lot of dailies and to-dos, but the issue began a week or so ago and I had the same amount of them before that and everything went smoothly. Currently 2 party members. Cleared old completed to-dos. The poor response is really located on the inventory screen, and a little less so the social screen (especially when typing). I did recently get all of the regular pets, not sure if that's related. Tried it in firefox and everything runs great.

Nario commented 10 years ago

Running Chrome 35.0.1916.114 m, my preferred browser. I've tried Firefox, Internet Explorer, Safari, Opera... Chrome is my favorite by far, and I will continue to use it no matter what.

I really like this game, but the Inventory and Pets pages take so long to load. On the Pets page especially, I have to wait 15+ seconds to be able to click on anything, or even switch tabs on my web browser when on the Pets page. None of the other pages are nearly this bad. Most of my pages load very quickly, and run without performance issues. However, pretty much all of HabitRPG's website is plagued with slowdown, taking time to click things, etc. The more icon that are on the page, the longer it takes to do anything. I used to be by myself and the Tasks wouldn't take too long to do anything, but now that I'm in a party, the Tasks menu too is kinda hard to use. And going through the Pets menu is like a giant loading time, with each click taking 15 seconds to happen.

I browse a lot of websites, and HabitRPG is the only one to give me issues. I can even play modern games like Portal 2 and Sonic Generations on my computer, so I don't get it. :( I really wish this was fixed, because it's honestly discouraging me from playing. Heck, I was even considering subscribing, but ever since all this slowdown stuff started happening, it has me waiting. I want to subscribe, I want to play, please fix this game. :(

paglias commented 10 years ago

@Nario HabitRPG is far heavier than most sites because it's very complex. What are your computer's spec? I use even on my phone (a galaxy nexus, more than 2 years old) and it's usable

Nario commented 10 years ago

Intel(R) Core(TM)2 Duo CPU P7450 @ 2.13GHz (basically a 2.13GHz dual-core processor) Nvidia GeForce GTX 260M (dedicated graphics 1GB video card) 4GB RAM Windows 8.1 Pro

I've also tried using my Android tablet, and it's even slower on that. It's an ASUS Transformer Prime.

paglias commented 10 years ago

Mmm... do you have many tasks? Also can you open the chrome's task manager and see how much ram is it using for Habit (right click on the tabs' bar)

2014-05-31 16:36 GMT+02:00, Nario notifications@github.com:

Intel(R) Core(TM)2 Duo CPU P7450 @ 2.13GHz (basically a 2.13GHz dual-core processor) Nvidia GeForce GTX 260M (dedicated graphics 1GB video card) 4GB RAM Windows 8.1 Pro

I've also tried using my Android tablet, and it's even slower on that. It's an ASUS Transformer Prime.


Reply to this email directly or view it on GitHub: https://github.com/HabitRPG/habitrpg/issues/3486#issuecomment-44749838

Matteo Pagliazzi - paglias.net

paglias commented 10 years ago

Or just Maiusc+ESC

Nario commented 10 years ago

I do have a lot of tasks, but not many more from when it was running smoothly. 21 Habits (including both good and bad), 15 Dailies (I used to have more when I was employed to keep me on track, but I just resigned Wednesday), and 17 To Dos (I used to have a lot more). I used to have more before the slowdown started. It just doesn't make sense to me. It is especially slow in the Pets section, even though I only have 3 out of 90 Pets (it was still super slow even when I had 0 Pets)

And as for the RAM usage, here's what I get from Chrome's task manager (THANK YOU for explaining how to use it!):

HabitRPG (in Tasks): 110,392K HabitRPG (in Pets): 144,796K (and keeps rising). HabitRPG (in Inventory): 121,096K (fluctuates) HabitRPG (in Party, currently fighting The Spirit of Spring with four others): 136,236K (and the page runs much more smoothly than the Pets and Inventory pages)

It should also be noted that my other pages on Chrome don't use up nearly as much RAM as HabitRPG does.

wc8 commented 10 years ago

I have been having trouble today in FF, many pink Application Error dialogs, and several times the whole site's an Application Error. Console message for that last one was:

Use of getUserData() or setUserData() is deprecated. Use WeakMap or element.dataset instead.

Faranae commented 10 years ago

To provide a counter example, I have no problems with Habit's site. I'm running Chrome Version 35.0.1916.114 m, and I have merfy's Custom Compact Style enabled. I do not have any remotely relevant extensions/add-ons installed (I have two for work, one of which serves as a mobile screen emulation when I need it, and one which sends links to my mobile phone). I am running Windows 8.1 (up to date on patches), 8 gigs of RAM, Intel i7-4700 HQ processor at 2.40 Ghz and a GeForce 750m video card. It's a mid-range Asus touchscreen laptop, so it's all fancy! ;)

17 Habits, 10 checklisted to-dos, 17+ plain to-dos, between 5 and 10 dailies. My party only has one other person and we are quiet. 6 guilds. 6 challenges. And I spent too much time in the Tavern.

lefnire commented 10 years ago

@paglias I wonder if these recent performance issues (this, #3558, etc) are due to i18n because now we have listeners on functions (eg, {{egg.text()}}). TMK, Angular will constantly re-calculate function watchers, whereas with variable watchers they're only recalculated on change (IIRC via some ES6 watchers -like shim?). Thoughts?

lefnire commented 10 years ago

in which case, let's make use of @snicker's bindonce examples throughout the code, since content taken from content.coffee will never change

paglias commented 10 years ago

Angular will "recalculate" variables too, they are checked against the old value at every digest cycle. The only difference is that functions have to be executed before being checked. So, memory usage should be the same, it may be slower responding to changes but given the number of pets (~100, right?) it shouldn't matter much. Anyway I'll check tomorrow. If we find out it's a problem Angular 1.3 introduced a feature similar to bindonce. Il 10/giu/2014 19:49 "Tyler Renelle" notifications@github.com ha scritto:

@paglias https://github.com/paglias I wonder if these recent performance issues (this, #3558 https://github.com/HabitRPG/habitrpg/issues/3558, etc) are due to i18n because now we have listeners on functions (eg, {{egg.text()}}). TMK, Angular will constantly re-calculate function watchers, whereas with variable watchers they're only recalculated on change (IIRC via some ES6 watchers -like shim?). Thoughts?

— Reply to this email directly or view it on GitHub https://github.com/HabitRPG/habitrpg/issues/3486#issuecomment-45648062.

lefnire commented 10 years ago

Oooo! https://github.com/angular/angular.js/commit/cee429f0aaebf32ef1c9aedd8447a48f163dd0a4 wonderful, glad they came around!

lefnire commented 10 years ago

Better yet, there are probably tons of locations (pets, mounts, etc) where the listing can be rendered on the server because it's iterating shared.content.pets, etc. See what I did here: https://github.com/HabitRPG/habitrpg/commit/e3aeaab64174832924da5033750c0e8f6ff64fc8#diff-b6a686f2828fc4a8bf002f80aa07fc01R241 for an example. I'll take a look at pets/mounts when I get a chance for such a thing

lefnire commented 10 years ago

Voila! https://github.com/HabitRPG/habitrpg/commit/df1867ef4dd464fcae44f4a8147b7622f1056221

Nario commented 10 years ago

Did the issue get fixed? Because the Pets and Inventory pages run as smooth as butter now, just like the rest of the Internet! :) Whoever is responsible for this: thank you!

ghost commented 10 years ago

I just switched to chrome (fresh install) and I still have this issue, especially with tavern chat (it gives me an oops! error everytime I start typing)

lefnire commented 10 years ago

No, the issue is not fixed. I've fixed it for pets and mounts, and my above comments show how I did that so the same can be applied throughout the rest of the site (eg, equipment, market, etc). I plan to tackle it myself, but put that there in case someone can hit it before me (I find myself with less and less time)

gkiernozek commented 10 years ago

nice job for pets and mounts! :) works great :)

lefnire commented 10 years ago

I'm gonna work on chat right soon. Can anyone experiencing this list tabs where it's still a problem?

casicastiel commented 10 years ago

Guilds, party and tavern are excruciatingly slow on mobile chrome, haven't been on desktop to compare in a few days.

lefnire commented 10 years ago

Guilds / party / tavern all share the same chat code, so hopefully one-stop fix. Pushed a commit, could someone check if it improved?

FWIW, my theory is that a recent version of Angular is no longer compatible with the bindonce library. Instead of working on upgrading bindonce and making any necessary changes, we have {{::foo}} at our fingertips now with Angular 1.3 core - so I'll go through and gut bindonce as I find it

Earendilgrey commented 10 years ago

I was having this problem with all the pages, but now it is just the Market now that lags really bad for me. I have to wait forever for it to hatch any of my eggs when I click on them.

lefnire commented 10 years ago

Market & equipment, √. (d6d2be9 - not live, will come with next push). Keep 'em coming as y'all find them.

mapkiwi commented 10 years ago

Have been experiencing heaps of lag on the tasks screen for a while now, using Chrome 36.0.1985.125 m, although other pages like Market/Pets run a lot faster. Using Firefox clears up all problems but I really want to get back to using Chrome as it is my preferred browser :(

bTackt commented 9 years ago

I also have problems with this--I won't repeat everything that's been said here, but this is my problem. My computer isn't a spectacularly strong one (by that I mean that it cannot hold very heavy applications up well, as I assume Habit to be), but my sister, who uses Habit on the same network, on the same OS and browser (Windows 7, [latest] Chrome) has no problems with speed. Just another information bit, if it helps at all. This might point to something with particular computer specs, but that would have to do with some sort of thresholding or something. idk.

Alys commented 9 years ago

@knittingfrenzy18 Could you please tell us roughly how many tasks and rewards you have and how many your sister has? If you don't want to count them, go to the Data Display Tool (from the website's Data menu) and use the "Tasks Statistics" section. The count of rewards is under the table.

bTackt commented 9 years ago

Well my sister is not letting me even look at her habit (-_-) but she estimates 20 habits, 20 dailies, 3 todos, and 5 rewards. I've got 15-20 habits, 15-20 dailies, 30-35 todos (a lot!) and ~5 rewards. I do keep a lot of todos + checklists in said todos.

bTackt commented 9 years ago

Wait, to be noted: My account runs fine on other machines in the house. It's just my computer/setup.

Salstar24 commented 9 years ago

Hi, I can add that I'm having the problem with chat in Guilds and the Tavern and Private Messages - very slow to catch up with what I typed, but at least it doesn't forget it and it turns up eventually.

I'm on Chrome, version 40.0.2214.93 m and the rest of the site is OK for speed. :) I use a Toshiba laptop which is about three years' old now if that's relevant.

deilann commented 9 years ago

This is happenig to me again as well.

On Sat, Jan 31, 2015 at 6:32 AM, Salstar24 notifications@github.com wrote:

Hi, I can add that I'm having the problem with chat in Guilds and the Tavern and Private Messages - very slow to catch up with what I typed, but at least it doesn't forget it and it turns up eventually.

I'm on Chrome, version 40.0.2214.93 m and the rest of the site is OK for speed. :) I use a Toshiba laptop which is about three years' old now if that's relevant.

— Reply to this email directly or view it on GitHub https://github.com/HabitRPG/habitrpg/issues/3486#issuecomment-72319888.

paglias commented 9 years ago

me too, but only for party/tavern chat not PMs

blakeembrey commented 9 years ago

It looks like there is a memory leak somewhere:

image

lapost48 commented 9 years ago

I noticed that when I am on my Mac I don't have this issue but when I am on my Windows machine the text input takes 30+ seconds to register and place the text in the box.

Andrux51 commented 9 years ago

I noticed that there's a huge amount of pageload happening from images coming in. I was thinking one step toward a solution for this issue could be lazy loading or loading images on demand. I'm playing around with a potential fix, but this could be a pretty big undertaking. Will update as applicable...

Andrux51 commented 9 years ago

Also, the sheer number of http requests going on is pretty large. It would probably be beneficial to use something like grunt-usemin to condense the 3rd party libraries (angular, jquery, etc) and only load their minified versions.

Andrux51 commented 9 years ago

Another thing, the pages with long content (guilds, challenges, tavern, etc) could have improved performance by implementing pagination. Instead of traditional pagination (like google search, for example) I would suggest an infinite scroll effect (like twitter, facebook, etc.)

Bootstrap has a Scrollspy jquery plugin built in which can be used to easily handle this style of pagination - basically, the idea would be to initially load a page of [25?] records, then after scrolling past about 1/5 of the records, load another page.

Bootstrap Scrollspy

Pseudocode (obviously some tweaking will be needed, but this is the basic idea)

var spyScrollId = (page*pageSize) + (pageSize/5);

$('body').scrollspy({ target: '.spy-'+spyScrollId });

$('body').on('activate.bs.scrollspy', function() { 
    // fetch another page from the api
    // something like:
    $http.get('/api/v2/challenges?skip='+page*pageSize+'&take='+pageSize,
        function(data) { 
            // load data into DOM here
    })
    page++;
    spyScrollId = (page*pageSize) + (pageSize/5);
    $('body').scrollspy({ target: '.spy-'+spyScrollId });

    // this is necessary when adding DOM elements
    $('[data-spy="scroll"]').each(function () {
        var $spy = $(this).scrollspy('refresh')
    });
});
Andrux51 commented 9 years ago

New discovery... the node router is basically serving all the content, instead of letting angular do most of the heavy lifting for loading a given page. This is likely to be the biggest culprit in slow initial page load, and will require a significant refactor.