this post was submitted on 12 May 2024
616 points (92.2% liked)

Programmer Humor

19555 readers
349 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 9 points 6 months ago (1 children)

There is no way to make a network request faster than a function call.

Apologies in advance if this it too pedantic, but this isn't necessarily true. If you're talking about an operation call that takes ~seconds to run, then the network overhead is negligible. And if you need specialized hardware for it, then it definitely could be delegate it out to a separate machine over the network. Examples could include requiring a GPU, more RAM, or even a faster CPU if your main application is running on more power-efficient CPUs.

I'm not saying that this is true in every case - they are definitely niche cases. But I definitely wouldn't say that network requests are never faster than local function calls.

[โ€“] [email protected] 3 points 6 months ago

Well put. And this is a generic pattern; for example, GPUs are only faster than CPUs if the cost of preparing the GPU and retrieving the result is faster than directly evaluating the algorithm on the CPU. This also applies to main memory! Anything outside of the CPU can incur a latency/throughput/scaling tradeoff.