News for hackers. Stuff that matters.
Re:“Clean” Code, Horrible Performance by TeMPOraL on Tuesday February 28, 2023 @06:12PM (#34976273)
It's the same problem. Virtual calls are degenerate, in-process RPCs. Or put another way, the reason you make tons of RPCs is the same reason you make tons of virtual calls: you consider services or subclasses to be cheap, so you use them a lot to mold your systems to organizational/people problems instead of the thing the software is supposed to do.
Re:“Clean” Code, Horrible Performance by kyle-rb on Tuesday February 28, 2023 @07:57PM (#34977303)
IMO the main difference is that for ~98% of people writing code, subclasses actually are very cheap. The performance losses (11 cycles per iteration?) aren't enough to dissuade me from organizing my code cleanly.
Re:“Clean” Code, Horrible Performance by icedchai on Tuesday February 28, 2023 @10:34PM (#34978455)
It's more than performance. Some of the worst code I've worked on has had too many layers of sub-classes, making it difficult to navigate and a real loss to developer productivity. After a certain point, it becomes OO spaghetti or, more accurately, "lasagna." At more than 3 layers, you really need to stop and think if it's necessary.