Live data from Hacker News

Computers are fast

blog.hackensplat.com

21–30 of 54 posts

Re: Computers are fast

#21
post #11

Something I like thinking about: Your computer can (probably) perform a few dozen arithmetic operations or a few stores/reads in the time light leaving your monitor takes to reach your eye balls. edit: not to mention GPUs

I just had to do arithmetic. A 3 GHz processor would clock about 10.006671 cycles in the time it takes for light to travel 1 meter.

Current Intel Core CPUs have 3 ALUs/core and 2 cores..

Re: Computers are fast

#23
post #6

Earlier quoted context omitted.

I blame I/O. It's pretty fast warmed up.

Sometimes I wonder if the OS can put very heavily used files from the FS into RAM. Some software just sucks and keeps pulling the same files over and over... ... and the plus side is, if an application needs the RAM, no harm done, just dump the file from RAM and read it from disk.

Good idea. They already do it.

Re: Computers are fast

#24
post #11

Something I like thinking about: Your computer can (probably) perform a few dozen arithmetic operations or a few stores/reads in the time light leaving your monitor takes to reach your eye balls. edit: not to mention GPUs

I don't think so.

Light travels about 1 foot/nanosecond, so the travel time from monitor to eyeball is 1 or 2 nanoseconds, which might be 2 or 3 clock cycles. So I think at most 3 operations per CPU.

Re: Computers are fast

#25
post #11

Something I like thinking about: Your computer can (probably) perform a few dozen arithmetic operations or a few stores/reads in the time light leaving your monitor takes to reach your eye balls. edit: not to mention GPUs

I don't think so. Light travels about 1 foot/nanosecond, so the travel time from monitor to eyeball is 1 or 2 nanoseconds, which might be 2 or 3 clock cycles. So I think at most 3 operations per CPU.

There's 2 to 3 feet between me and my screen, my cpu has 2 cores, and modern CPUs can perform many simple arithmetic operations per clock cycle, per core. Not to mention what's happening in my GPU.

Re: Computers are fast

#26
post #7
post #3

I sometimes feel bad that I'm not more of an "algorythms developer", that I don't read all(any) research papers, that I don't remember what RedBlack Trees are, that other than minimal attention to using decent basic structures and reasonable bigO operaions (e.g hashes, don't pop of front of array in loop) when I sit down and code I invariably brute force it. OTOH, I encounter the "computers are fast" phenomenon 9 out…

I'm on the other side of your situation. These days, nine out of ten times I'm looking at papers, algorithms, lots of paper with big-O and cache nitpicking, brainstorming with others trying to make those 20 Gbps turn to 60.. Speed is a direct product of simplicity, and for me simple is elegant. I also think speed is important enough for me to feel strongly about cutting down a "feature" or two, to just make the damne…

Well I think it's a combination of two things. Most days when I'm writing a web app or some other high level program I kind of chuck data about without thinking about it.

When I put on my kernel dev hat or when I was working on SQL Server I spent all day making sure other me could throw data around haphazardly and not get stuck on a course-grained kernel lock or only hit 1/8 of the pipelines.

Sometimes it's just too much to handle all at once, even if you know what you're doing in both domains.

Re: Computers are fast

#27
post #14
post #10

Earlier quoted context omitted.

I/O is one of my biggest daily pains. Spend some time in Process Explorer on Windows and you can see just how much disk-based I/O the average app is doing. Anti-virus software makes the bad problem worse. It's just like pouring sugar in a gastank. Why isn't more software designed to take advantage, where appropriate, of large amounts of RAM?

Did you see that article on the Varnish site about second-guessing Virtual Memory? "2006 programmng" I think it was.

obligatory HN links:

Varnish dev says second-guessing VM is so 1975: http://news.ycombinator.com/item?id=1554656 OR http://news.ycombinator.com/item?id=1760811

Redis dev says second-guessing VM is elite (and not doing so is so 2006): http://news.ycombinator.com/item?id=1760540

Re: Computers are fast

#28
post #6
post #4

Yes. Computers are fast. Who cares about algorithms... Premature optimization is evil... But why then it is so annoying that Visual Studio starts longer than my whole custom linux system in VM on the same computer...

I blame I/O. It's pretty fast warmed up.

That seems to be the lesson. Don't worry about a few thousands flops here or there, put your focus on minimizing IO.

Re: Computers are fast

#29
post #13

CPUs are fast but the ratio of latency of random access vs. maximum bandwidth is getting worse. In nanoseconds, approximately: 10^7 Disk seek 10^4 2KB over 1Gbps 10^2 RAM uncached reference 10^1 L2/L3 cache reference 10^0 L1 cache reference That's why systems don't feel fast lately. In particular for big data or bloated software that can't fit well within the caches or shared systems doing a lot of frequent switches…

SSD's have become viable in terms of $/GB to justify them in a server room these days. I'd highly recommend moving to them (for your boot drive/VMs at least). It will make a world of difference. $400 may seem like a lot to spend for 160GB of storage, but knocking off two orders of magnitude off your seek time quickly becomes worth it when you're running four VMs off it at once.

Re: Computers are fast

#30

A long time ago I was working on a data conversion project that involved taking what was essentially a 10 dimensional data set and reordering it. The easiest way to achieve this was to load everything into a ten dimensional array and read it out in another order, but I was sure this would take too long. So I spent some time trying to get a sparse array implementation working until I finally sat down and worked out th…

Another: I solved the 8-queens problem for a magazine contest using a BASIC program (!) Instead of modelling the board with an 8X8 array, I used the digits 1-8 representing the height of the queen (row #), and the 8 digits in a string as the heights for each column. I permuted the digits - n! time to execute which was never going to finish.

So, prune! as it swapped digits left to right in a Grey-code-like sequence, test the digits to the left for diagonals (|row#A - row#B| == |A-B|) and don't bother to recurse if its already failing.

Every few minutes - out popped a solution, and it finished in under 25 minutes.

Nowadays, that would take imperceptible time to execute.

Post reply on HN