
New Twitter Has Become Browser Poison - mikecane
http://mikecanex.wordpress.com/2011/01/17/new-twitter-has-become-browser-poison/
======
russ
Over time, NewTwitter does incur a large memory footprint. I've been traveling
for a month and haven't looked into the problem in depth, but I'd bet the
major culprit is our aggressive caching techniques. It's also worth
investigating the number of polls and their frequencies. Timeline refreshes
are dropped back to 90 seconds when the tab isn't focused, but not sure about
other ones.

As most people have reported, infinite scroll is an easy way to introduce a
slowdown over time. The sheer number of DOM nodes becomes quite significant -
there are things we can do to ameliorate that issue, as well. Will take a look
tomorrow. The feedback is greatly appreciated.

~~~
saurik
Infinite scroll is also a way to make scrolling infuriating, especially if you
are wanting to click links and fan out from that location: it forces you to
avoid your browser's carefully designed history stack like the plague (opening
new tabs or windows for navigation instead) lest you lose your incredibly
valuable document you've carefully been scrolling down in (and which is now so
large it is threatening to cripple your browser anyway). What happened to
normal "next page" paradigms? Does user testing really show that infinite
scroll is better?

~~~
wahnfrieden
That's not a problem inherent to infinite scroll at all. It's easily fixed by
setting a hash value on the current page (the #foo in a URL) corresponding to
the current scroll state, and updating it each time infinite scroll happens.

Why Twitter doesn't implement something like this is a whole different issue.

~~~
russ
You can imagine attempting to support something like this when the user has
scrolled 20 pages worth through a timeline. We could, of course, backfill
newer tweets subsequently up to the most recent (taking a minimum of two
requests and a maximum of 20), but this would be expensive.

I mentioned somewhere else in this thread that we could maintain an accurate
scroll height but detach more recent tweets when a timeline is scrolled a long
distance. We could do the same thing here, and backfill as the user scrolls
up. There are some challenging things to get right though if the user decides
to jump to the top, etc. Definitely non-trivial.

~~~
wahnfrieden
Thanks for the response, I thought the reality would be much more complicated
due to issues of scale.

This is primarily about supporting the back button, and I don't think users
expect the latest data when going back through their browser history -
generally pages aren't refreshed, and that's not an unusual or unexpected
behavior. So you could cache each page state, without worrying about
displaying newer tweets, though the caching mechanism itself incurs some
nontrivial cost.

------
rhizome
The thing I noticed in the slow new Twitter is that typing a new status seems
to involve continuous autofill-like behavior for each character typed, which
seemed to introduce round-trip lag (or javascript-parsing, or...) and causes
characters to appear at a rate of ~1/second. Unusable.

And this is one way that dominant sites fall: business considerations are
given priority over the user experience. Maybe they just have Flickr-itis and
just can't adapt to leaving well enough alone, but for the time being I'm on
old-Twitter and not contributing much to the Twitterverse until this is sorted
out. If it never winds up being fixed, I've got a head start in living without
them.

There is also a possible Second System Effect amongst Twitter's UX gods. It's
interesting that after having switched to the new Twitter a couplefew weeks
ago, last week I started seeing a "Wanna switch back to the old Twitter?"
header. Of course I did, but to me this possibly points to a level of
complaints that I did not realize.

~~~
j_baker
Or it could also point to a "Hey, this is different. I don't like change!"
reaction that you always get when you change something's UI.

~~~
rhizome
I don't think so. I'm not a huge tweeter and so anything that gets in the way
of the rare things really jumps out at me, of which the slow status box is no
small issue. Other than that the redesign is just that, an expanded sidebar
with some fleshed out boxes. No big deal. That it's causing different problems
for different people tells me that maybe something else is going on behind the
hood. Heck, maybe they just want to be the network and aren't interested in
providing a groovy webapp interface anymore, who knows.

------
epi0Bauqu
I've been keeping twitter open in its own Firefox browser on one screen (of
three). It routinely refreshes itself and there is some kind of memory leak
whereas after a day it is consuming about half a gig of memory, forcing me to
kill and restart.

~~~
ComputerGuru
Firefox has crazy memory leaks. Don't blame it on twitter, regardless how bad
their code may be.

A tab should be completely and utterly destroyed when refreshed. It doesn't
matter how much memory it used, refreshing it or navigating away from that
page should (ignoring optimizations, caching, etc. etc. etc.) be like you were
never there.

Just look at the hundreds of complaints here:
[http://neosmart.net/blog/2008/firefox-3-is-still-a-memory-
ho...](http://neosmart.net/blog/2008/firefox-3-is-still-a-memory-hog/)

~~~
naner
_Firefox has crazy memory leaks._

Proof? This was the case with Firefox 2 but now it just seems like this is
part of their reputation and is not necessarily grounded in fact.

~~~
redthrowaway
I routinely leave my browser open for days on end and simply cycle through
tabs, closing and opening new ones as needed, with usually ~10 open at a given
time. I, too, noticed that firefox was eating up about half a gig of ram even
when it wasn't doing anything, didn't have any youtube tabs open, etc. It got
to the point where I would have to close firefox and restart after a day or
two. Chrome fixed that. Now, I just use firefox with the modify headers
extension to watch domain-specific video, and have no plans to go back.

~~~
petdog
Now, maybe I'm to blame here, using the nightly build of chromium, but webkit
is a walking memory leak. Just for a comparison, I have the same amount of
tabs on firefox and chromium and firefox is using 500mb of ram, while chromium
is using 3.5 GIGABYTES. And I'm not even using it much. But really, the
problem is easily reproducible. Just open whatever webkit based browser you
want, and keep reloading the same moderately big page. Ram goes up, never to
return. That works with a trivial program that embeds webkit via gtk, too. Or
you can just look at the commits on webkit: a couple of leaks fixes every
week.

~~~
comex
Good thing Chrome kills the entire process hosting a tab when you close it.

------
bergie
In other news, you'll be way more productive if you don't hang out on Twitter
all day :-)

~~~
joelhaasnoot
And use some sort of browser extension...

------
Semiapies
I can't help thinking that the tacked-on whine about _this is why people want
iPads and not PCs_ would make more sense if this post were not about a web-app
that would probably slow down any tablet it was accessed on.

~~~
mikeklaas
No, because the site wouldn't be able to consume cpu and memory in a
background tab on the ipad.

~~~
Semiapies
In that case, wouldn't the "new twitter" view be utterly useless on the iPad,
anyway? Couldn't you as easily go to it with a bookmark?

------
wizard_2
I noticed the same thing on my girlfriends CR-48, twitter wont scroll properly
(studders) and everything else hangs a bit. She filed a bug report with google
chrome os support, but I suspect twitter is doing a lot of heavy stuff in the
background.

~~~
spinchange
I've noticed the same thing on mine. It seems like the site is only functional
when you first load it. After new tweets start rolling in, it becomes worse
and worse. I don't think it's the fault of the CR-48, I think we're just
seeing the effects worse on this hardware.

~~~
wyclif
Same thing here. It's not ChromeOS-related? I note the same problem in
Chromium.

------
watmough
Agreed, the new twitter is way demanding compared to the older version.

Once they stop allowing the old version, I'll probably have twitter loaded
much less. On a core 2 duo, even scrolling in new twitter is way below par.

Is there a low cpu-usage client? I tried one of the flash based ones, but it
brought the fans permanently on on my MacBook... Yeah, that's not going to
fly.

~~~
kylec
I'm using the new Twitter client from the Mac App Store - it's quite good:

<http://itunes.apple.com/us/app/twitter/id409789998?mt=12>

~~~
rdl
While it's better than the web UI, it suffers from the "mp3 player" problem of
trying to make up its own widget library and UI style, and actually is kind of
lame in a lot of ways (there is no top-level "new tweet" button, which is kind
of a feature of all the mobile clients, and it's definitely a pain to use for
DM conversations. It pops up weird non-standard shaped windows all over. I'd
consider it a respectable indy effort, but pretty disappointing for Twitter,
Inc.

------
seanalltogether
New MBP here. It looks like it stays at a constant 7-8% cpu while sitting on
the page, with momentary spikes to 30% every 15 seconds or so.

~~~
watmough
3% cpu continuously is enough to make a (my) macbook noticeably hotter.

------
cgrubb
I've experimented with the new twitter web app on both Chrome and Safari
(Mac).

It automatically loads a chunk of data when I scroll to the bottom. The CPU
use seems to be proportional to the number of chunks that have been loaded.
Initially about 2% and increasing to 50% with 20 chunks.

The new twitter almost unusable because of this. Hoping for a fix soon.

------
mikecane
The point of my post is also this: Something changed in the behavior of New
Twitter. None of this happened when I was first given access to NT months ago.
The problems seemed to crop up simulataneously -- coincidentally -- with my
moving to Opera 11 beta. The problems have since spread to all 3 of the
browsers I wound up cycling through. So I think Twitter changed something on
their end and are unaware of the ripple effect on some users. Someone, on
Twitter, suggested they were once polling every 90 seconds in the beginning
and now that the switch is complete, we are getting "live streaming." That
might be too much for some systems to handle. Perhaps a user option to
throttle back polling? [typo edit]

~~~
russ
Currently, we're not live streaming. We poll every 30 seconds when focused and
fall back to 90 seconds unfocused. When we do push, we'll be using User
Streams (<http://dev.twitter.com/pages/user_streams>) with either Websockets
or Flash. Performance should improve when that happens. There are also some
other neat tricks we'll be able to do to make the site even faster.

~~~
mikecane
But something changed somewhere. Scrolling used to be a smooth experience. The
entire use of NT was exciting and not cloggy. Now it is hell scrolling and
very cloggy and even autocomplete of IDs is a torment. What did you guys do
over there to the code?

------
NathanKP
I didn't notice the excessive CPU usage until very recently, meaning that it
may be a recent patch or change causing this problem. Safari still operates
quite well as long as I don't have the Twitter tab open, and even then I don't
notice a slow down until a try to scroll the page.

That said, because of the problems with the web version I have switched to the
new standalone Twitter application for Mac OS X. I think this is better as
well as it allows me to use Growl notifications, notification sounds, and
other nice features.

------
Locke1689
This is the least scientific analysis I think anyone could get away with. Why
doesn't the author just profile the Twitter page to see how much time his CPU
spends executing Javascript code and how much memory it consumes while
running?

~~~
bkudria
The author mentioned Shockwave. I don't think he's too technical a user.

~~~
mikecane
I dropped Shockwave in there as yet another example of something else that
needs to be checked for the latest version. Not every plug-in is good about
saying there's an update and most of the time the update notifications come in
the middle of getting work done, so people tend to disable that distraction.

~~~
bkudria
Yeah - but New Twitter has absolutely nothing to do with Shockwave.

~~~
mikecane
Yes, I know that. You are taking it too literally, that one little bit. I was
simply listing a bunch of updates that techs always ask about having been
updated.

------
franze
well, i just deleted all twitter apps on my mac because they became too much
of a time hog, and well new twitter on the web sucks currently so this means
one thing ... i'm free

------
endlessvoid94
Am I the only person who doesn't keep twitter open constantly?

~~~
Semiapies
No. I only check it once or twice a workday.

However, this is because I use Google Reader to follow feeds and only use
Twitter to keep up to date with friends and acquaintances. That's not the
typical use-case.

------
Inviz
Profiling is a fair game, right?

[https://img.skitch.com/20110118-egpetjh52gwnsxr9ct2g8bxtad.p...](https://img.skitch.com/20110118-egpetjh52gwnsxr9ct2g8bxtad.png)

Gives a deep insight on what contributes slowdown to new twitter.

EDIT: I mean, that's on 3GHz 4GB RAM machine. No wonder it freezes slower
computers.

------
russ
The pronounced slowness was primarily due to an upgrade from jQuery 1.4.2 to
1.4.4 (we're going to downgrade). In addition, we're moving from listening to
the scroll event to a time-based dispatcher for loading subsequent pages of
tweets.

------
twodayslate
New Twitter has a login popup everytime I open it. I am already logged in. I
can close this popup and my twitter experience is not effected. Why is this
thing even there?

~~~
russ
Is the popup a HTTP Basic Auth window? If so, are you using Firefox? This is a
ridiculously elusive bug that a couple of us have been trying to diagnose. It
appears to be buried in the FF implementation of XHR when a reference to an
XHR instance is shared across iFrames. We're working on it.

~~~
bzbarsky
Have you done a Firefox HTTP log? I'd be curious to see what the browser
thinks is going on here...

------
sudonim
otoh, Twitter.app on the Mac is awesome.

~~~
simonw
... except it uses the t.co URL shortener by default for everything you post.
I had to switch back to the old Tweetie (which doesn't do this).

~~~
j_baker
I'm curious, what's wrong with t.co?

~~~
simonw
I don't want all of my URLs shortened.

------
chaosfox
isn't the whole point of chrome's tab-process thingy to avoid one tab f __-ing
up the rest ? if it's as the author says, that's not helping that much.

------
Raphael
Good luck doing anything intensive on a Celeron.

~~~
1337p337
Twitter is a web UI for a stream of messages. It shouldn't _be_ CPU-intensive.

~~~
tsmith
Good point, though not quite contradicting that of the grandparent post.

------
Daverk
New twitter page doesn't work on Opera browser

------
piramida
what is twitter?

------
andrewljohnson
I wouldn't even consider keeping Twitter or Facebook open in a tab. That's a
sure way to get less done.

