4 ms·
Tell HN: Threads fast
I just rewrote the code that generates the threads page to be faster. It used to be slow the first time you called it after a restart because it had to load lot of items into memory. Now items aren't loaded till the moment they're needed. This also makes it possible to show an unlimited number of threads.
- jws 17y agoI had stopped using threads because I felt bad about the load I was imposing, frequently running until a timeout failure. Now it is indistinguishable from instantaneous.
- blhack 17y ago>I felt bad about the load I was imposing This is how you know you've got loyal users.
- robryan 17y agoAs a user of adwords I always feel bad clicking on an sponsored link in Google knowing I'm not going to buy anything.
- samratjp 17y agoYet it's amazing how there is another end of the spectrum where people are hired to cost their competitors. Just the other day, I learned that apparently "Mesothelioma" is one of the more expensive AdWords that easily goes around $40!
- asnyder 17y agoAs my mathematician partner always say, it's not unlimited, but rather a very very large amount. I've learned to stop saying unlimited or infinite around him, unless I can prove it theoretically, else he'll go into this shpeel about the finite number of atoms in the universe.
- jrockway 17y agoUnlimited means that the system imposes no limit on the number of threads to be displayed -- each page uses a constant amount of resources, so there is no limit to how far back in your history you can go. That is my reading, anyway.
- tptacek 17y agoYes. Threads fast. Thank you.
- jrockway 17y agoVery nice. Slow threads were annoying me due to the proxy at work -- if a page took too long to respond, it would just randomly show some other page from news.yc that happened to be in the cache. (Yes, really. Now I know who else reads HN at work, and what topcolors they have chosen. ;) This was a problem, because it seems that after I wrote a post, I immediately realized there was some error, and I needed to fix it. The page that loads after you "add commment" was also affected by the cache bug, so I couldn't get an edit link there. I would have to try "threads" a number of times, and eventually, if I was lucky, I would get the edit link. Then I could fix my post. Frustrating. (And not really HN's fault, FWIW.) I haven't tried this through the proxy yet, but it seems massively faster from home, which should make the work proxy happier. Thanks!
- andrewcooke 17y agoi'm curious - which proxy software does that?
- jrockway 17y agoNo idea. It's probably very expensive, though. (The goal of our IT department is to spend the most money implementing the worst possible solutions. If it doesn't cost $5,000,000 per user per year, we're not interested. Example: I have to type 3 passwords to connect to the VPN!)
- andrewcooke 17y agoHa! Maybe I should try bidding for their work - sounds like a nice client to have ;o)
- MikeCapone 17y agoThank you, much appreciated!
- axod 17y agoAwesome :) Looking much better from here. Thanks
- ax0n 17y agoCrazy lightning fast! Much appreciated.
- cperciva 17y agoThreads aren't really fast. The fact that you have a shared VM space allows you to avoid the cost of swapping page tables (and flushing any logically-addressed cache) but you still have to store and restore the entire architectural state, which can easily take a few hundred cycles on systems with lots of registers. Co-routines are much faster, since they allow the compiler to optimize away handling of state which it knows isn't important. ... oh wait, wrong type of threads.
- jrockway 17y agoIncidentally, the only usable Perl threads are implemented on top of coroutines: http://search.cpan.org/~mlehmann/Coro-5.22/Coro.pm http://search.cpan.org/~mlehmann/Coro-5.22/Coro.pm Just don't read the rant about why call/cc is useless.
- dood 17y agoExcellent, any chance the 'saved' page can get a little improvement also? At the moment it often just times out for me.
- pg 17y agoThat's next on my list.
- pg 17y agoShould work reasonably well now.
- boundlessdreamz 17y agoIt timed out the first time, then loaded fast the next time.
- dmoney 17y agoIt works for me. Thanks.
- oomkiller 17y agoOh thank you, it was so slow, but its now zippy as can be!
- icey 17y agoHUGE difference for me, thanks! Actually, everything seems faster, not just /threads
- anigbrowl 17y agoThank you Paul!