News for hackers. Stuff that matters.
Re:Do You Know How Much Your Computer Can Do in a Second? by jiggawatts on Thursday June 22, 2023 @05:06PM (#36439019)
I like to test people’s intuition of computer power by asking them how many multiplications their phone or PC can make in the time it takes light to cross the room.

The way to estimate this is that light takes 3ns to go 1m. If the room is 10m wide, that’s 30ns. At typical frequencies that’s 100 clocks. With, say, 8 cores that’s 800 steps. At each step a core can retire about 8 multiplies using AVX vector instructions. The estimate of 6,400 multiplications is actually very conservative because you also have the GPU! Even low end models can put out hundreds of thousands of multiplications in 30ns. High end models can do about a million.

When asked, most people estimate “1 to 10”. Even programmers and IT professionals do not have a mental model of how fast computers really are.

Re:Do You Know How Much Your Computer Can Do in a Second? by arp242 on Thursday June 22, 2023 @05:16PM (#36439135)
To be honest I think this is almost a trick question, because you're combining two very different things (speed of light and performance of computers), and people are not very good at combining these sort of contexts intuitively (i.e. you need to do the calculations).

The other day I was watching The Twilight Zone, and one episode involves a crew "655 million miles" from Earth. I know what miles are, I know the rough layout and scale of the solar system, galaxy, and universe, but I had no idea how far away that actually is because it mixes these two units from very different contexts and intuitively it just doesn't make sense to me; is it still in the solar system? No idea. Converting it to AU showed it's about 7 AU, which put it in the appropriate context: a bit beyond Jupiter.

Re:Do You Know How Much Your Computer Can Do in a Second? by imoverclocked on Thursday June 22, 2023 @05:52PM (#36439585)
The real question is, "how many Twilight Zone episodes away from ubiquitous quantum computing are we?" (is joke)

Units definitely matter but anything outside of our day to day experience is difficult to communicate widely. I think most people don't know more than Jupiter is actually really far away and really really big compared to the Earth. 7 AU means nothing to my brain just like 655 million miles. It's a computed unit based on mean distance from the center of the Earth to the center of the Sun; I also have no idea how far we are from the Sun because my brain just experiences a hot circle in the sky. The only reason these things seem to make sense is because we have seen really vague maps of the Solar System. Other falsely but widely-accepted measures include using state sizes to describe other regions. People readily accept it despite never having been to said state or potentially any other state ... or even across their own state.

I think these are accepted because of a false confidence in understanding (think Dunning-Kruger) based on the fact that we have some information.

Personal anecdote: A friend flew from the East coast to Arizona and asked if we could just drive to the other side of the state to see the Grand Canyon in the evening. I had to explain that it's 6 hours one-way despite being in the same state. Had I instead said "Arizona is the size of 22 Connecticuts," the idea of how long it would take to get there would still not make any sense.

PS: I said "vague map of the Solar System" because generally nothing is always the correct scale. Either the planetary distances are the correct scale from each other or the planets are the correct scale from each other for pragmatic reasons. Sometimes, none of those things are scaled properly. Some animations attempt to show things correctly but that's still difficult to comprehend because of the non-linear velocities required to keep the attention of the viewer.

Re:Do You Know How Much Your Computer Can Do in a Second? by hatthew on Friday June 23, 2023 @01:49AM (#36443269)
To me, 655 million miles means literally nothing to me beyond "really really far." Probably further than the moon I think? Definitely closer than the nearest non-sun star.

7 AU has at least some meaning. Further than the sun. Probably closer than Jupiter if I had to guess? Definitely closer than Pluto. Would take on the order of 100 minutes for light to travel that distance. We could send a space vehicle there in a single-digit number of years.

My brain can't comprehend either number in the context of my morning commute, but at least it can comprehend 7 AU in the context that that number was given. I can't tell you how long it would take to walk that distance, but that doesn't matter since nobody will ever walk that distance. What I am able to do is make inferences about the implications of that distance (assuming no fiction/sci-fi stuff): we could have a conversation with a few back and forth messages over the course of the day, and they aren't getting home any time soon but they probably won't die of old age.

That's the point being made about combining contexts.

Re:Do You Know How Much Your Computer Can Do in a Second? by aardvark179 on Thursday June 22, 2023 @06:14PM (#36439877)
What units do you think you know the scale of the solar system in? The speed of light is approximately 300 million meters per second, so call it 300 thousand kilometres per second, or very roughly 200 thousand miles.

Also, if I were asking that sort of question in an interview I would fine with a candidate getting a conversion wrong as long as they explain their thought process, and I’d help them correct the error early. I’m this sort of question is t meant to be a trick, it’s about whether you can connect different variables which may not appear connected at first glance.

Re:Do You Know How Much Your Computer Can Do in a Second? by bedobi on Thursday June 22, 2023 @07:45PM (#36440810)
> it's about

It's about absolutely nothing at all. You can project whatever you want on pointless questions like that. Whatever you think you're measuring in a candidate by asking them, well, you're not, lol.

Re:Do You Know How Much Your Computer Can Do in a Second? by weebull on Friday June 23, 2023 @07:30AM (#36445410)
> What units do you think you know the scale of the solar system in?

AU

Re:Do You Know How Much Your Computer Can Do in a Second? by arp242 on Friday June 23, 2023 @08:26AM (#36445898)
> if I were asking that sort of question in an interview

The impression I had was that the question was asked in a social context: over coffee, beers, or something like that.

> What units do you think you know the scale of the solar system in?

AU, as I mentioned: https://en.wikipedia.org/wiki/Astronomical_unit

Re:Do You Know How Much Your Computer Can Do in a Second? by furyofantares on Thursday June 22, 2023 @08:51PM (#36441315)
I don't even know the scale of the earth, or even the state I live in, in a way that makes any physical or intuitive sense to me. It's almost purely a mathematical understanding.

It's always fun to see the repeated scale analogies as you build your way to enormous sizes and distances, starting with something familiar, zooming to something 100 or 1000 times bigger, doing it again and again. It engages our physical understanding while counting zeroes 2 or 3 at a time, but I don't think it actually gives us any physical understanding. It really is just counting zeroes.

I just don't think there's any chance you or anyone else has any idea how far Jupiter is except as a calculation.

Re:Do You Know How Much Your Computer Can Do in a Second? by dylan604 on Thursday June 22, 2023 @11:24PM (#36442419)
>or even the state I live in

I can wake up in my hometown, drive west for 12 hours, and still be in the same state. I know how big my state is in those terms. How many miles is that? How many football fields is that? How many times does light cross the room during that travel distance?

Re:Do You Know How Much Your Computer Can Do in a Second? by 2143 on Friday June 23, 2023 @12:11AM (#36442701)
Depends on your average speed.
Re:Do You Know How Much Your Computer Can Do in a Second? by fredley on Friday June 23, 2023 @02:55AM (#36443687)
The traffic can be that bad where I am too.
Re:Do You Know How Much Your Computer Can Do in a Second? by arp242 on Friday June 23, 2023 @08:21AM (#36445837)
> I just don't think there's any chance you or anyone else has any idea how far Jupiter is except as a calculation.

I agree, it's very hard – almost impossible – to really "understand" things at scales that are so far outside of our human experience and intuition. However, "near Jupiter" does put things in to relative proportion, whereas "X million miles" doesn't.

Re:Do You Know How Much Your Computer Can Do in a Second? by krick on Thursday June 22, 2023 @09:18PM (#36441568)
> because you're combining two very different things (speed of light and performance of computers), and people are not very good at combining these sort of contexts

I'm not saying I like GPs puzzle, but I could kinda answer that question (my estimation was a bit higher, assuming GP's answer is exactly correct) only because he combined these contexts. Ask me, how many multiplications a computer can do in 30 ns and I'll say, well, I dunno, 10? Well, ok, I'm kinda used to log-times in μs, so maybe I'll say 100. I have no idea how much is 30 ns, but it sure seems a short time.

Also, I don't remember what is the speed of light. Probably, I can figure it out, if I try, but I can't just say from the top of my head.

What I can say instantly from the top of my head, though, is that individual computations are performed with a speed of light, literally, and that a single transistor in my PC is about a billion times smaller than my room, so assuming a single multiplication takes about a hundred of logic gate operations (again, I cannot really tell without thinking, but seems legit) I'll say: well, about 10 million, I guess? And it doesn't matter that I don't know how much time it'll take for light to travel across my room.

Re:Do You Know How Much Your Computer Can Do in a Second? by capn_duck on Friday June 23, 2023 @01:42AM (#36443233)
At no point during your rambling, incoherent response were you even close to something that could be considered rational thought.
Re:Do You Know How Much Your Computer Can Do in a Second? by rsaesha on Friday June 23, 2023 @02:25AM (#36443503)
Hard disagree - to me it made a lot of sense.
Re:Do You Know How Much Your Computer Can Do in a Second? by pyinstallwoes on Friday June 23, 2023 @01:26AM (#36443146)
How is it very different? The speed of light is based on a length and so is a second. Clocks per second and light speed are directly related to distance.
Re:Do You Know How Much Your Computer Can Do in a Second? by parentheses on Friday June 23, 2023 @01:40AM (#36443223)
I think it captures something magical - that computers can do so much while a photon is in transit. This is something that to us is the definition of instantaneous (intuitively - not actually).
Re:Do You Know How Much Your Computer Can Do in a Second? by firecall on Friday June 23, 2023 @01:52AM (#36443280)
I agree.

I don’t think understanding the speed of light is something that can be considered intuitive by most people.

There is no generally observable way to understand the speed of light, it’s just instant to most people.

So without physics training, people just have no idea.

I always like the comparison of more computing power than it took to put a man on the moon!

Which used to be along the lines of a phone or car had more computing power than NASA in 1969.

But these days it’s probably a toothbrush ;-)

So it’s not as useful anymore.

I also have no idea of what level of computation converts to something practical. A million calculations a second means nothing on its own; what can that do? Draw a picture on the screen? Print a PDF?

So it has to convert to practical understanding.

Still, it’s a nerdy and fun comparison but one that isn’t understandable or relatable to the layperson.

Re:Do You Know How Much Your Computer Can Do in a Second? by diarrhea on Friday June 23, 2023 @02:53AM (#36443673)
The speed of light is a physics topic, but I’d argue it’s relevant to most people working in IT: it’s the maximum speed information can travel at.

Anything involving networks is very much affected by it. The internet runs on fiber, where the speed of light is a fundamental constant! Even electricity in copper obeys those same limitations.

Re:Do You Know How Much Your Computer Can Do in a Second? by boomlinde on Friday June 23, 2023 @03:35AM (#36443914)
Similarly, anything involving staying alive is affected by the distance from earth to the sun. Doesn't mean that it's relevant for anyone interested in staying alive to know it.
Re:Do You Know How Much Your Computer Can Do in a Second? by Hunpeter on Friday June 23, 2023 @03:55AM (#36444046)
Re:Do You Know How Much Your Computer Can Do in a Second? by wongarsu on Friday June 23, 2023 @05:07AM (#36444482)
However unless you work in high frequency trading or are trying to layout components for a GPU you can generally ignore speed of light delays below a couple hundred miles. You might develop an understanding for the rough travel time at light speed from New York to San Francisco, or Frankfurt to Sydney, but that doesn't translate to a good understanding how long light takes from this end of the room to the other end.
Re:Do You Know How Much Your Computer Can Do in a Second? by Someone on Friday June 23, 2023 @05:50AM (#36444739)
I think that’s mostly theoretical. There’s a lot of hardware on long connections that adds latency. The signal also may take fairly large detours (in some cases, it may even hop via a geosynchronous satellite. That adds about 70.000km to a trip, and another 70.000 for the return signal. For most users that is a thing of the past, though)

For example, when I ping microsoft.com, I get something around 100ms (Aside: what does that time mean? Round-trip or one way? I read a few man pages for ping, but couldn’t find out)

There also is the weirdness that, when pinging apple.com or google.com I get about 6 ms. They must be playing tricks with DNS.

Re:Do You Know How Much Your Computer Can Do in a Second? by diarrhea on Friday June 23, 2023 @05:59AM (#36444800)
It mainly acts as a lower bound. If your pings return 5ns, you know that answer cannot possible be correct. But I agree that's a rather constructed use case.
Re:Do You Know How Much Your Computer Can Do in a Second? by icoder on Friday June 23, 2023 @04:13AM (#36444153)
Agree but to be fair I wouldn't have known the answer either if they said 30ns.

Then again, I do know as a dev that unless it's happening every frame (ie for games), as long as you're not introducing non-scalable complexity, the computation time of a bit of reasoning is often negligible.

Re:Do You Know How Much Your Computer Can Do in a Second? by jstanley on Thursday June 22, 2023 @05:08PM (#36439042)
> Even programmers and IT professionals have literally not mental model of how fast computers really are.

Or of how slow light is!

Re:Do You Know How Much Your Computer Can Do in a Second? by paulddraper on Thursday June 22, 2023 @05:28PM (#36439280)
Exactly.

Speed of light is not exactly a relatable point of reference.

Re:Do You Know How Much Your Computer Can Do in a Second? by jiggawatts on Thursday June 22, 2023 @07:15PM (#36440538)
It ought to be intuitive for everyone working in software development!

The performance of everything is limited in one way or another by ‘c’.

Not just WAN links, but the data centre Ethernet as well. The distance to the disks matters. The physical size of the motherboard. The placement of caches, etc…

When people say things like “putting the compute near the data” they’re implicitly talking about overcoming the limits imposed by the speed of light.

When you hear about an N+1 performance issue in some ORM, that’s bad because of the speed of light.

When you test your LAN with “ping”, you’re lying to yourself because it won’t show measurements below 1 ms, which is an eternity.

I just told you how much compute can occur in just 10 nanoseconds.

Go ping something. Look at the “1 ms” in the output. Go back to my post and work out what can occur in 1,000,000 nanoseconds. Go look at the 1 ms again.

Repeat until you have an epiphany about your zone redundant Kubernetes-hosted cloud native microservices architecture.

Re:Do You Know How Much Your Computer Can Do in a Second? by BenjiWiebe on Thursday June 22, 2023 @09:08PM (#36441471)
FYI the ping utility in linux shows 3 significant figures. On my lan it's reporting 0.156ms avg between two hosts.
Re:Do You Know How Much Your Computer Can Do in a Second? by jiggawatts on Friday June 23, 2023 @04:34AM (#36444286)
150 microseconds is typical, but for reference, Azure gets about 85µs between VMs in proximity placement groups, and I've heard of single-digit latencies with high-end RDMA NICs.

Your ping is 156,000 nanoseconds. You just saw that you can in principle do about 6,400 computations per 30ns, so... that's about 33 million arithmetic calculations per round-trip, within the data centre.

I hope this makes you see every unnecessary network hop in a different light.

PS: It typically takes 3 round-trips to establish a TCP connection, and 5-7 for a TLS connection. A database connection over TLS needs a few more. And then you have load balancers, firewalls, proxies, envoy, ingress, dapr, and, and, and...

Re:Do You Know How Much Your Computer Can Do in a Second? by Dylan16807 on Friday June 23, 2023 @12:25AM (#36442768)
Speed of light between datacenters is important.

Datacenter Ethernet has too much overhead to make a difference in almost all cases. Disks have an even higher overhead:distance ratio. The size of a motherboard only matters for signal integrity, not that half a nanosecond extra. Cache location inside a chip can matter, but even then size is a significantly bigger factor than location.

Re:Do You Know How Much Your Computer Can Do in a Second? by dylan604 on Thursday June 22, 2023 @11:24PM (#36442423)
Except we know nothing is faster than light, so that's a reference people know
Re:Do You Know How Much Your Computer Can Do in a Second? by pyinstallwoes on Friday June 23, 2023 @01:30AM (#36443165)
Unless you don’t measure it, then it’s as fast as it needs to be!

Oh group velocity.

Re:Do You Know How Much Your Computer Can Do in a Second? by elboru on Thursday June 22, 2023 @05:54PM (#36439603)
This site[0] helped me improve my mental model. You can scroll through the solar system at scale (the moon being one pixel). It takes a while!!

Then you notice a small button at the right bottom corner, that button allows you to auto-scroll at the speed of light, wow, now that’s slow!

[0]https://joshworth.com/dev/pixelspace/pixelspace_solarsystem....

Re:Do You Know How Much Your Computer Can Do in a Second? by nomel on Thursday June 22, 2023 @06:04PM (#36439741)
Makes you realize that space travel isn't going to happen with current physics.
Re:Do You Know How Much Your Computer Can Do in a Second? by porphyra on Thursday June 22, 2023 @06:29PM (#36440044)
The faster you go, the shorter you have to travel due to length contraction. So travelling really far distances is still possible, for example, by constant acceleration [1]. It's just that everyone you left behind will have been dead for billions of years by the time you arrive.

[1] https://en.wikipedia.org/wiki/Space_travel_under_constant_ac...

Re:Do You Know How Much Your Computer Can Do in a Second? by nomel on Thursday June 22, 2023 @08:21PM (#36441090)
> for example, by constant acceleration

Yes, this is why it won't happen, with our current understanding of physics, and the practical limitation that implies, with the resources we have. ;)

Re:Do You Know How Much Your Computer Can Do in a Second? by bitwize on Thursday June 22, 2023 @10:12PM (#36441985)
> It's just that everyone you left behind will have been dead for billions of years by the time you arrive.

sad piano plinks

https://www.youtube.com/watch?v=kEVZ3NIoEAE

Re:Do You Know How Much Your Computer Can Do in a Second? by rsaesha on Friday June 23, 2023 @03:58AM (#36444063)
To illustrate the problem of accelerating any relevant piece of mass at relativistic speeds, observe how the kinetic energy increases towards infinity as the object approaches the light speed:

https://files.mtstatic.com/site_4539/12414/0/webview?Expires...

This means it's required infinite energy to reach c speed for any mass.

And c speed is quite slow for space travel.

Just for the fun of it, let's imagine humanity has assembled, in space, an aircraft-carrier sized vessel, fully equipped to function and nurture the little humans living inside of it.

Weight: 100 ktons.

Power is infinite ok, because badly rewarded nerds discovered new physics. Good for them they are now immortals of human history.

With Lorentz kinetic energy equation, one can estimate the kinect energy this vessel would have while traveling at say, 1% of the speed of light.

Energy: 4.5*10^20 J.

This is about two thirds of the total energy Earth receives from the sun in one hour. Or close enough to the energy the world consumed in 2017.

Now we have humans inside a vessel hurdling through space at 0.01 c, in addition to the pre-existing humans in a planet swirling through space. But there is a problem! It would take 424 years to reach the nearest star system. So we need to go faster and maybe break things. Hopefully not the hull, though.

F*** it let's go 0.5 c and reach Andromeda in about 9 years - long enough to write a book.

Energy: 1.4*10^24 J.

That's 3x the energy released by the Chicxulub meteor impact. Or 30+ times the 2003 world's total fossil fuel reserves.

Which raises the question what is the fuel being used?

Doesn't matter ok because new physics, we are transforming mass literally in energy no constraints 100% efficiency lol.

By e=mc^2 that fuel would weight - at least - 14.9 ktons.

There is margin for error, since the vessel would be shedding mass, and getting lighter. That would allow engineering to run the global process at 80% efficiency, which is a very realistic metric and maybe miss a turn or two on the way to the neighboring star.

Returns not included.

Re:Do You Know How Much Your Computer Can Do in a Second? by dumdumchan on Friday June 23, 2023 @05:05AM (#36444470)
5 minutes after you takeoff you hit a pebble that obliterates your entire ship because you're covering billions of cubic meters of volume every second (in your time).
Re:Do You Know How Much Your Computer Can Do in a Second? by landryraccoon on Friday June 23, 2023 @12:23AM (#36442756)
We’ve already been to space, so it has happened with current physics.

I suppose the question is where do you want to go and how much luggage do you want to take with you?

Re:Do You Know How Much Your Computer Can Do in a Second? by idiocrat on Thursday June 22, 2023 @09:33PM (#36441707)
Re:Do You Know How Much Your Computer Can Do in a Second? by chrismorgan on Friday June 23, 2023 @03:19AM (#36443820)
I’m an Australian. A lot of the internet I interact with is in America, and a lot of the rest is in Europe. These are all hundreds of milliseconds away by fibreoptic cable, the latency of which is proportional to the speed of light.

I’ve been to America a few times. The internet is so fast there: not because of bandwidth differences, but because of latency, and especially sites carelessly loading chains of resources, which amplify the effects.

As soon as you deal in intercontinental stuff, you realise just how slow light is.

(As for studies in the effects of page load abandonment, those are never in the slightest bit relatable—at the time those studies suggest half the people are giving up, most sites still haven’t rendered anything at all, here.)

Re:Do You Know How Much Your Computer Can Do in a Second? by citrin_ru on Friday June 23, 2023 @05:37AM (#36444658)
Speed of light is the lower bound for network latency but actual internet latency also significantly affected by delays added by network equipment (routers/switches). Typically the bigger distance the more routers there are in between so this delay is also proportional to the distance. And sometimes there are almost saturated channels so there is a significant queuing delay for packets waiting to be sent. RTT AU <-> US will be higher than RTT for most pairs inside the US but RTT for the same distance within the US can vary more than 3x depending on exact network infrastructure on the way.
Re:Do You Know How Much Your Computer Can Do in a Second? by Cold_Miserable on Friday June 23, 2023 @10:24AM (#36447218)
Using fibre-optic cable where light travels in a zig-zag instead of using lasers increases latency too.
Re:Do You Know How Much Your Computer Can Do in a Second? by jebarker on Friday June 23, 2023 @10:54AM (#36447638)
I recently encountered this from both sides in my work. I was trying to get a particular single-threaded CPU program running in less than 1 microsecond. Light goes about 300m in that time. I remember reading around the same time that the Eiffel Tower is about 300m tall. So it stuck in my head that if someone switched a flashlight on at the bottom of the Eiffel Tower at the same time as my program starts the program should complete before someone at the top of the tower sees the light.
Re:Do You Know How Much Your Computer Can Do in a Second? by rcoveson on Thursday June 22, 2023 @05:58PM (#36439654)
Sounds like most people estimate surprisingly well. Fermi-wise, the obscure term in your numerator is 10^10 and the obscure term in your denominator is 10^8. The more obvious term (room size) is 10^1. So the answer is 10^3, and people are guessing 10^0 or 10^1. So some people are only off by a couple order of magnitude, which is explained by a rather small estimation error in either or both obscure terms.
Re:Do You Know How Much Your Computer Can Do in a Second? by moffkalast on Thursday June 22, 2023 @06:19PM (#36439928)
Anyone else having a weird deja-vu moment while reading this?
Re:Do You Know How Much Your Computer Can Do in a Second? by cogman10 on Thursday June 22, 2023 @06:45PM (#36440227)
* Terms and conditions apply

What you are saying is technically true but with HUGE caveats. At this point, the issue isn't one of clock cycles but rather memory bandwidth and latency. Even assuming the best case, a hit in L1 cache, you are looking at +1ns to move the data from memory into the registers. But now talk about L2, L3, or worse system memory? Oof. And then you mention GPUs, but that problem is compounded 10x due to the bandwidth constraints of PCIe.

I mean, sure, if your CPU is doing nothing other than multiplying the same value by 2 over and over again, it can do that wickedly fast. However, once you start talking about large swaths, gigs even, of data to operate against and those numbers start to take a precipitous drop.

Heck, one of the benefits of AVX isn't the fact that you can do 64 lanes of multiplication at once, but rather the fact that you can tell the CPU to grab 64 lanes worth of memory to work against at once.

This is why when you start looking at what is talked about when people talk about next gen math machines, it's not the FLOPs but instead the memory fabric that gets all the attention.

Re:Do You Know How Much Your Computer Can Do in a Second? by jiggawatts on Thursday June 22, 2023 @07:08PM (#36440463)
Typical PC system memory bandwidths are on the order of 64GB/s with DDR5.

That’s 64 bytes per nanosecond, or 16 floats per ns, and hence 480 in the time needed for light to go 10 meters.

That’s the “base” performance. Caches and registers would improve on this significantly in realistic scenarios.

Again, this is why I like this thought experiment! It’s not a trick question. It’s testing intuitions.

People just think it’s a trick because their intuitions are so ridiculously out of whack with reality that they’re looking for the sleight of hand instead of reexamining their own notions.

Re:Do You Know How Much Your Computer Can Do in a Second? by cogman10 on Thursday June 22, 2023 @07:30PM (#36440690)
> That’s 64 bytes per nanosecond, or 16 floats per ns, and hence 480 in the time needed for light to go 10 meters.

Again, terms and conditions.

The slow part for memory access isn't how much memory can be piped over the wire but rather how fast a request for the next chunk of memory can be issued. So while it's possible to get those 480 multiplications that relies on the cache being warm and the memory access being predictable to the CPU. If either of those two constraints are violated, then the number of multiplications is severely decreased.

In other words, the more frequently you have to tell the memory controller to get more memory, the less work you can do.

To put it in perspective, it costs around 100 cycles to load something from main memory. Imagine you are talking about something like an n body simulation that may be accessing memory all over the heap. In the worst case, you are looking at 4 multiplications (if multiplying by a scaler) and perhaps even just 2 multiplications if you need 2 memory pulls per multiplication.

Caches don't just help, they are necessary to come anywhere near achieving that 480 number.

Just a little history lesson.

Once upon a time, the memory controller didn't exist on the CPU, it was on a separate chip (the north bridge). Whenever the CPU wanted to load memory, it'd send a request to the north bridge and the north bridge would send that request to main memory.

One of the huge improvements to CPU performance for both Intel and AMD was integrating the memory controller onto the CPU. Why? Because they shortened the distance a request for memory, and the memory itself, had to travel significantly. Electrical signals travel at about 2/3 the speed of light and if your memory is 0.1 meter from the CPU, you can see how many requests for a new chunk of memory can really slow down everything.

This is fundamentally why nVidia's big GPGPU processors they sell to datacenters come chock full of memory. Because they want to limit the amount of time and times the GPGPU has to reach back into main memory to process stuff. It's far quicker to load up the 20gb of ram on the card in one go then to need to constantly pull that data over the PCIe line.

Re:Do You Know How Much Your Computer Can Do in a Second? by jiggawatts on Thursday June 22, 2023 @07:43PM (#36440790)
The clarify my scenario: I'm looking for the rate, not the total from a standing start.

To use an analogy: I'm not asking how far a car can go on the highway if accelerating from zero, but how far it can move if moving at highway speeds.

Nonetheless, the latency to main memory is also a great example of how bad programmers' intuitions are! A processor can perform thousands of operations in the time it takes for it to wait for just one memory access.

RAM is the new disk, and disk is the new tape.

PS: There was an article on here just a couple of days ago about how "handles are better than references". I didn't see many comments pointing out that this doubles the number of memory requests required when chasing pointers, halving the overall performance!

Re:Do You Know How Much Your Computer Can Do in a Second? by Dylan16807 on Friday June 23, 2023 @12:18AM (#36442736)
> The clarify my scenario: I'm looking for the rate, not the total from a standing start.

> To use an analogy: I'm not asking how far a car can go on the highway if accelerating from zero, but how far it can move if moving at highway speeds.

The terms and conditions keep applying. The everyday real world conditions implied by "highway speed" include regular cache misses and branches.

It's not about "start" or "acceleration". This massively impacts the steady state speed.

If you want a car analogy, tight vector packing compares to normal code about as well as looking at the speed and width of the flame front across a cylinder and using that to measure fuel consumption.

Re:Do You Know How Much Your Computer Can Do in a Second? by hnfong on Friday June 23, 2023 @03:11AM (#36443783)
Not sure what you mean by testing intuitions. Which intuitions?

It sounds more like testing whether you know the speed of DDR5 without looking it up, and doing a bunch of basic unit conversions.

And your analysis doesn't even cover latency (which GP mentioned), which apparently according to my first google result is ~90ns. So unless your data is already in a cache it might not even be fetched within the requisite time.

Your question sounds like a trick question because there are so many nuances and gotchas, and if you're asked this question without a concrete context and the problem one's trying to solve, it's basically a check of whether the interviewee's mental model of computation matches the interviewer's. And as this thread shows, even among (presumably) competent people, the factors to consider can differ quite a bit.

Re:Do You Know How Much Your Computer Can Do in a Second? by cogman10 on Friday June 23, 2023 @12:20PM (#36448993)
Precisely my point.

What I’ve seen, intuition wise, on where slowness is in computation it’s usually along the terms of “how many FLOPs can this do?” or “How much bandwidth does this have?”. But that’s a tiny fraction of the story. Very little computation is boring math operations.

It’s true, CPUs are absurdly fast at multiplying 2 numbers together. That’s not what trips them up. What trips them up is getting those two numbers and determining when those 2 numbers should be multiplied. Those two problems are so hard that CPUs are often guessing, running the calculation, and then backtracking if they guessed wrong.

And that action has lead to side channel attacks (spectre, meltdown) which can leak information about data to malicious software.

This is why such a question doesn’t have either an intuitive or non-intuitive answer. It’s very strictly “it depends”. And if you boiled it all the way down to “no, what’s the absolute max it can do” you are now talking about software problems that don’t exist/aren’t valuable.

Consider, what execute the add instruction faster, a 3.4 ghz CPU from 2004 or a 3.4ghz CPU from 2023? The answer is they are the same. Both do the add in 1 cycle. Did you learn anything about the performance of a 2004 CPU vs a 2023 CPU? Heck no. That’s because how fast the CPU can execute instructions has almost nothing to do with how fast it can process data. (Yes, I’m aware that even the above statement is somewhat incorrect as x86 CPUs do weird things with adds where they’ll run multiple additions per cycle with some clever reordering… Not even that example can be simple. Assume they didn’t).

The trivia question is a boring question. The actual interesting discussion is “so WHY aren’t we doing multiplications that fast?”. That is what can actually lead to deeper understandings about what slows things down in computing. There’s a reason the 10ghz CPU never surfaced. It’s not because we couldn’t make it, it’s because we couldn’t keep it busy.

Re:Do You Know How Much Your Computer Can Do in a Second? by ball_of_lint on Thursday June 22, 2023 @08:45PM (#36441268)
1-10 is pretty accurate for a single CPU with random memory access. Sure, the GPU can physically perform many more in parallel, but then you get into the exact size of the gpu and how fast you can copy to/from memory to it which isn't the point of the question.
Re:Do You Know How Much Your Computer Can Do in a Second? by ipython on Thursday June 22, 2023 @09:30PM (#36441674)
You should bring up Admiral Grace Hopper’s description of this on the Letterman show: https://m.youtube.com/watch?v=oE2uls6iIEU
Re:Do You Know How Much Your Computer Can Do in a Second? by Solvency on Thursday June 22, 2023 @09:47PM (#36441822)
And yet: Electron apps.
Re:Do You Know How Much Your Computer Can Do in a Second? by circuit10 on Sunday June 25, 2023 @05:01AM (#36466231)
It is amazing how much of that incredible performance we can eat up and then end up with something slow anyway

And also the fact that we eat up just enough of that performance for it to be slow sometimes but usually no more, because we can’t

Re:Do You Know How Much Your Computer Can Do in a Second? by solardev on Friday June 23, 2023 @12:12AM (#36442708)
Isn't this kinda like a convoluted version of a FLOP?
Re:Do You Know How Much Your Computer Can Do in a Second? by photochemsyn on Friday June 23, 2023 @12:51AM (#36442923)
Maybe something like "starting from 2, how many sequential prime numbers can your computer generate mathematically, in the time it takes light to cross the diameter of the Earth" would be a more interesting measure?
Re:Do You Know How Much Your Computer Can Do in a Second? by devoutsalsa on Friday June 23, 2023 @06:58AM (#36445207)
What is the relative velocity of the computer? Is it moving at 99.999% the percent the speed of light relative to the observer? In what reference frame is the observation being done?