Anne Currie: Hello and welcome to Asynchronous and Unreliable, a new weekly podcast where we discuss the most interesting ideas and concepts in tech. your host, Anne Currie, co-author of Building Green Software, The Cloud Native Attitude and author of the Science Fiction Panopticon series. And today going to be talking about the endlessly interesting topic of code efficiency. And for my who could be better than long-term tech veteran and expert on code efficiency, Jon Berger, who as my husband Thank you very much for listening to Asynchronous and Unreliable podcast. If you enjoyed the show and you want us to create more content, please do show your support by hitting the subscribe button below. It really does make a difference. Thank you very much. many decades happens to be usefully cached locally. So, Jon you've been in tech for ⁓ well over 30 years. ⁓ been involved in creating, growing, leading organizations that are all about building mission critical software. That's high performance and high resilience software. And a lot of your perspective that we're going to be talking about today comes from delivering that code, which has to be at the highest possible end of efficiency. specifically networking code. So means code that's running on routers and switches and things. So tell us a little bit about maybe about yourself, but also about why that code has to be so efficient.
Jon Berger: So that's a good question in the area of both voice and data networking. The scale of the modern Internet is just absolutely incredible, and it's enabled by the network. And that means the network has to do an awful lot of very hard work in the data plane. That the bit of the network that is processing, moving ⁓ your from one place to another, then ⁓ We're talking about processing billions of packets per second. is ⁓ little time to process each packet. And you couldn't operate at that level, then the amount of equipment and the size of the network you'd need would just be would be absolutely ludicrous and prohibitive. So the and in control plane. which is the bit of the network you don't really see, but is the bit of the network that controls the data plane that tells that ⁓ the different pieces of networking equipment to negotiate between each other about how to get from A to B. Then you've got to build up a picture, you know, logically ⁓ the entire network or some decent proportion of it and manipulating that in real time as it changes to be able to do job. So ⁓ This very high performance because it's billions of things per second. And not billions of things per second across some distributed system in a cloud. That's billions of things per second on one single piece of hardware. I think that was the answer to the question.
Anne Currie: will say it's interesting. I mean, networking, to give our listeners or viewers a bit of background here, you were involved in the writing of building green software. You our primary consultant on the code efficiency chapter ⁓ and the networking chapter because you and... and all of your many friends in the code efficiency field were invaluable when it came to helping Sara and and I write that. Because really, I think you could argue effectively networking code the fastest code on the planet, isn't it?
Jon Berger: I to know for sure. ⁓ It's certainly some of the highest performing code on the planet. I'm not an expert on high frequency trading, but I understand that they that's an where every every ⁓ femto second But networking is an area where historically people have looked into
Anne Currie: Thank
Jon Berger: writing code in in assembler because shaving off one from processing a packet was meaningfully useful. So, ⁓ know, that's I'm not going to necessarily say it's it's the number one, but it's you know, it's ⁓ it's a
Anne Currie: Yeah, and yes, it is, you say, incredibly important. And not only does it have to be incredibly fast and performant it has to be very resilient as well, it? Because the internet, oddly enough, you're running this ridiculously high performance code over often quite flaky underpinnings. So historically very flaky underpinnings. And still has to keep going. And so performance and resilience are really built into the literally the fabric of the internet. ⁓
Jon Berger: Yeah, and there's there's always, I guess, two ways of looking at that resilience. One is ensuring that your code is of reasonable quality such that it doesn't fall over very often. And the other one is that if something goes wrong, there's some way of recovering, failing over switching over to something else without losing. data or without losing time performance. And so, you know, one of those is more, one of those is more about design. The other one is more about the execution.
Anne Currie: is ⁓ interesting. So, Bergman and I ⁓ recorded an a ⁓ couple of episodes we talked a bit about code efficiency versus operational and how much, when we were writing Building Green Software, a lot of people were asking us to write mostly about code efficiency, because ⁓ it really is where everybody that where the big improvements in overall efficiency are hidden. We had to fight very hard ⁓ try and say, well, ⁓ might be amazingly good what you can achieve with code efficiency, but it's very hard to achieve it. And it isn't for the for almost everybody in the world. It's not where you start. And you with operational efficiency, because no matter how good your code efficiency is, if your operational efficiency isn't fantastic, all that all that effort you're putting into code efficiency will be wasted. an interesting one that code efficiency is amazing in networking, but operational efficiency is just as important, more is more important, isn't it really?
Jon Berger: Yeah, mean, operational efficiency is always going to be the low hanging fruit and brings many, many, other benefits in terms of being able to ⁓ move fast, to deploy more often, to ⁓ to new features more easily and more safely. They both require expertise, but operational efficiency, probably you can get away with increasing operational efficiency with a relatively small number of people that have good ideas and know what they're doing. Whereas code efficiency, at least before AI wrote all the code for you, was something that required in breadth and depth. You needed a lot of people ⁓ could do that. And that's really as in there aren't that many of them and therefore they command higher salaries, but it's just really difficult to do and to deploy those engineers at
Anne Currie: Yeah, mean, it's incredibly expensive. It's incredibly difficult. Even the big players don't do anywhere near as much of it as you would hope because it's so expensive and to do. I think the other thing that I say, this is something ⁓ we being a married couple, it's over the breakfast table, we discuss code efficiency versus operational efficiency all the time. That's the exciting kind of married life we lead. And one of the things that's really quite interesting, and you're always correcting me, because well, we met on a graduate training program 30 odd years ago for the kind of software that you went on continue to write, so really high performance software, distributed systems, that kind of thing. And I left after 10 years, but you stayed there your entire career until finally the company sold to Microsoft and then a few years back. But yes, it's of the difficult about operational efficiency versus code efficiency is that it's to say that one system is more operationally efficient ⁓ than another. you really, ⁓ I think quite common, the extremes of inefficiency. ⁓ Obviously you can anything, ⁓ any degree of useful system. versus a really high end operationally efficient system. This is maybe a 10x difference. There's no 10x difference between an who's just kind of doing your bare minimum, maybe not even ⁓ following, following best practice, but still running a successful business, which is quite common. And Google, are the operational efficiency kings and queens. of the world is only kind of ⁓ style differences, a kind of like it's a straight line difference between operational efficiency. But code efficiency, it's more an exponential scale, you know, it's 100,000, it's a million times difference, ⁓ even more that between somebody writing kind of ordinary stuff that's running every day and somebody writing really, really hyper efficient software. ⁓ And so better or worse becomes somewhat meaningless in that ⁓ ridiculously exponential on that ridiculous and on it's a logarithmic scale as opposed to a non logarithmic scale. So operational efficiency is an ordinary scale. Code efficiency is on a logarithmic scale. What do you do you think that's the right way to think about it? Or is it a useful way to think about it?
Jon Berger: I don't know. you're saying that for operational efficiency, because obviously ⁓ can write infinitely inefficient software. ⁓ what you're saying or infinitely inefficient software for operationally, tends to be, ⁓ you're not saying worst imaginable or worst ever.
Anne Currie: I
Jon Berger: is 10 times worse than Google, but just in normal usage, that's the sort of range that you might see. I expect it's bigger than that. But you're right, it's probably ⁓ it not be a million times in code terms, then, yeah, a million X wouldn't be unusual. And. ⁓ know, there are number of reasons for that. is We have spent as an industry the last three decades basically creating platforms which allow software engineers to be more efficient. I write code more quickly, almost all of which come at the expense of performance. We've traded off ⁓ software engineer performance against losses on the actual software performance. All level languages. are less efficient than just writing machine code. But writing machine code is really, really, really slow and probably would be quite hard to employ a lot of people who really wanted to do it. writing in Python, Java, much, much, much quicker. code is going to execute way slower. So that's ⁓ of the reasons and one that often comes up is just which language is more efficient. But actually ⁓ those languages, there are several orders of magnitude differences in other choices you make. There might be design choices about how you glue your components together and how microservices might talk to each other or whether you're even using microservices or how you deploy your software and which algorithms to use, how you use them. most don't really have a really good understanding and don't a really good understanding ⁓ of those or how to make them, because actually it doesn't matter for most software. It could run 10 times slower, 100 times slower, a thousand times slower. And doesn't matter. It doesn't make any difference because if you're not doing billions of these things a second or you're not or you're below the limit of where your user could notice that you've done something or not. know, if the if your website responsiveness goes from being responsive in ato seconds to femto seconds,
Anne Currie: Yeah.
Jon Berger: doesn't matter.
Anne Currie: Yeah
Jon Berger: needs to get into decent numbers of milliseconds before anyone even cares. So there's a huge range of ⁓ system's to absorb inefficient software because the hardware now is so incredibly good. That didn't used be true. I think it was What was the book about the high frequency traders, the famous Flash Boys, where he talks about the engineers. This is 30 years ago now, guess. The engineers that were in really high demand to build these systems were Russian because the Russian software engineers had grown up
Anne Currie: Flash boys.
Jon Berger: without superfast modern, it was then, hardware that existed in the West. And so they'd had to work ⁓ really, hard to wring every percent of ⁓ performance of ⁓ what weak hardware they had. And so they were used to being able to write really, really, really high performance code, whereas Western engineers were already, this is 30 years ago, were already lazier.
Anne Currie: Ha
Jon Berger: in their ability to actually worry about that. And that's good laziness. That's not a criticism. Sometimes lazy is good. Don't do things you don't need to do. you can relatively inexpensively buy very high performance hardware, and that means you need to spend less of your constrained resource, which is your expensive software engineers, that's great trade off. That's exactly what you should be doing.
Anne Currie: and try those. Yeah. Yeah.
Jon Berger: that is what most of the world has been doing and doing for some time now.
Anne Currie: Yeah, well, so which kind of gets me onto it on a subject. mean, let's say we could talk endlessly about this, but we don't want to talk too much in each episode, because I'm sure we'll come back to this later. But at a high level, one of the things that is a constant breakfast table discussion for us is something that you comment on, which is that The reason why code is, so code is kind of 10,000, 100,000, a million times less efficient than it could be because it's written by and maintained by humans. is a human thing to be, for it to be. ⁓
Jon Berger: time of recording, that is mostly true.
Anne Currie: And in fact, if this doesn't go out for a couple of weeks, maybe it'll be different by then. because because that is the area where there is an astonishing amount of change potentially coming from AI. That's and you so one of the examples of this, the things that's most interested me recently is the the article that the papers published recently by OpenAI saying that they had written a new compiler written not in C, in Rust that could the Linux kernel. And they'd written it ⁓ using in a totally hands-off fashion. No human wrote single line of that Rust. And that is a sign that's... High-Performance code is going to change.
Jon Berger: enormously. I mean, all code is going to change and how quickly this will happen. We don't know, but it will happen. The expertise that is required to build high performance code is quite really is really tough discipline to learn as a software engineer. And it's not just a discipline It's not just. once you have that skill, then all code you write is high performance. An awful lot of the skill writing high performance code ⁓ a attitude to trial and error. It requires a go at something and seeing what the effect is, because there's so many different variables in terms of ⁓ that can affect performance of the code. So ⁓ You can look at an individual line of code and go, what does that look like? High performance or not? But that's I mean, that's really very much at the very easy end of the scale. you're looking at the amount of the amount of code you're writing and therefore how much code is in the cache at any one time, because if you have to load more code into the cache, that's a massive hit. ⁓ you have to ⁓ more data, that's a massive hit. So if your data isn't hacked helpfully or you don't have the ability to fetch the data in advance. Things like this are there are so many different dimensions that you can have a good guess and experienced engineers will ⁓ guess than less experienced engineers about what might help or what what is worth trying. But until you've really tried it, you won't really know. And that's expensive ⁓ on human But when human time is no longer a factor, then you can you can do those things much more efficiently. The other thing that you can do when your cost to write code is then you can have lots of different variants of a particular code base or a particular algorithm or a particular product, which are optimized for specific things, which would be totally mad if you've got to write all that code by hand because the maintainability nightmare of that would just like you your your that your costs become instantly prohibitive but If you've just got your code room for free then sure have as many different variants of that as as you need and and the the performance Opportunities available from AI written code are really quite incredible
Anne Currie: Yeah, astonishing.
Jon Berger: I mean, that's further off. That's further off, obviously, because it requires a whole load of other more complex reasoning about the way, about how the code is deployed. I guess that once you get beyond just AI writing any code, the next easiest thing to do would be to make it more efficient, because you're saying, take this thing that's already got well-defined inputs and outputs, and just rewrite it.
Anne Currie: Yeah.
Jon Berger: to go quicker. That's a very, very well defined job. very testable, relatively testable to, yeah, redeploy this whole system and make good guesses as to when you need to a specialized bit of code to go faster.
Anne Currie: So the interesting thing about this discussion is you might it as the opposite of the discussion that very recently had in release of episode of this podcast, which I will include in the show notes with Sara Bergman, where we're talking about code efficiency versus operational efficiency. And from her work at Microsoft, she was talking about the benefits of running code that ran on more than one that wasn't that for a CPU. which has enormous operational efficiency improvements because it means that you actually you can keep hardware that's that's that's for longer. You can move things around from place to place. You can move things that you need to run in a different data center or a different machine or a different ⁓ You get all of those operational efficiency improvements. So there's that it's a really This is an amazing example of the trade off between operational efficiency, which often you don't want to be too tuned for particular chip sets and code efficiency where to get to the really high end, you want to be incredibly tuned for a particular chip and set up an environment. are in the moment, everybody's to balance both those things and it causes quite a lot of confusion actually. We talk about efficiency, code efficiency and operational efficiency quite different, use quite different techniques for them.
Jon Berger: Yeah. Yeah, very different. And. I guess the so much of operational efficiency is is related to the system design, that's probably less that AI is doing for folks in the short term. But yes, building software in such a way that makes it easier to operate efficiently is something that. ⁓ Up until now, humans have had to worry about.
Anne Currie: Yeah, yeah, it is interesting. do think that there's a huge, there's this ⁓ huge opportunity AI to come to really to build green software far better. Well, code wise. So interestingly, in building software really common concentrated on operational efficiency is being the more human skill and it's the more useful and transferable and more, you it's a skill that every enterprise should have because it has all kinds of knock on effects on your cost and your resilience and your security and your performance. And you have to get it right first, because if you've got that wrong, You can do as much efficiency as you but if don't have ⁓ operational efficiency nailed, It's wasted and it was incredibly expensive. You cannot afford to waste it. you've got to have operational efficiency in the nailed first And is innately a more human. At this I'm guessing that operational efficiency will last as a human job longer than code efficiency. But who knows? It's hard, very hard to say.
Jon Berger: Yeah, I go along with that and that sounds likely. Although more and more of the actual operating will be done by AI. about operational efficiency will be a human job. it will just be too utterly terrifying for people to hand that over to AI for a little while.
Anne Currie: then in some ways that's that similar to, you know, ⁓ you know, it's that that kind of thing of just automating without the need for AI was terrifying at first. And in fact, most businesses have not ⁓ yet over to a totally automated data center yet. ⁓ That is a I wrote a book about it. ⁓ The Cloud Attitude. 10 years ago now and at that point I was thinking ⁓ well you know there are loads of it this is going to be here in two minutes it's still it really hasn't spread much more in the past in the past 10 years than it had done in the in first two or three years it's people are still a long way from basic automation of operations
Jon Berger: Yeah, it's true. I we started talking about the million time difference between most efficient and least efficient code. Obviously, it's much more than that. But even in ⁓ normal deployments, many times. ⁓ same is true in how people can can can operate software and build it. Because the is in terms of the scale at which people operate. The very largest companies operate at a scale that is like really, really difficult to imagine if you're an individual shop or an individual, just a business that's coping with a local area. fact that if Google, Microsoft, Amazon, ⁓ everything do ⁓ is tens of billions, ⁓ at minimum. That's the minimum scale of thing that you care about, which is the vast majority, for 99 % of businesses, that's beyond anything they could ever imagine. And that's fine. And a lot of people will correctly say, well, let's worry about getting a product that works and that anyone cares about, know, zero to one is hard. And then scaling that up is a different job. And it is a different job that requires different expertise.
Anne Currie: Yeah. Yeah, yeah, it is really, it is very interesting.
Jon Berger: And if you're one of those, if you're if you're a. A shop or if you're a a small business somewhere that has. Half a dozen employees and a hundred customers. you're not someone who's ever going to care about billion. You're not somebody should ever spend time worrying about massive levels of automation ⁓ or, know. shaving 1 % off this out of the other, because that will never be the thing that is actually useful to your business. It might be interesting for you to do personally, but it won't be what your CEO wants you to be doing. And if you are at the other end of the scale and you are operating at a hyperscaler, then it's not the job of everyone in the business to worry about that scale, but it's the job of a lot more people to
Anne Currie: you Yeah. Yeah. Yeah.
Jon Berger: Make sure that things operate operate safely at scale and and you can afford to spend a lot more on efficiency. And not just afford to if you don't you don't have a business.
Anne Currie: Yeah. Yeah. Yeah, I in the Green Software Maturity Matrix, which, you were also involved in reviewing and things, but the building green software, we do, we do suggest that for most businesses, there's a kind of like basic operational competence, which will usually, which is kind of like making sure you know what's running in your data centre And ⁓ is all you really that that will halve your costs and the halve of your carbon emissions. And it's, it's a not it's a it's you've got to have it is non-negotiable because if you don't, then those machines that you're not watching are the ones that get hacked. it's kind of basic operational required for all businesses don't have machines sitting there running, but you don't know what they're doing anymore. But that for most businesses, it doesn't pay off that much even kind of basic auto scaling and things like that. They're lovely to have, they, know, it's not the end world.
Jon Berger: You you say required. mean, I think but based on that definition of do you know what is running in your data center? Most businesses do not have basic operational competence. In fact, probably not many have that. Is that a problem?
Anne Currie: Yeah. Agreed.
Jon Berger: Yes, anyone who's doing something that they don't know that they're doing or don't or wouldn't choose to be doing, you could argue that's a problem. Is the problem worth addressing? Probably for most of those businesses, it isn't. If entire business is run off one ⁓ in the back room and % of what's running on that PC is stuff that you don't need to be running. a problem, but it might not be one that you ever decide to bother to do anything about if actually only need 5%. So you don't care about the inefficiency. Yes, it's a security hole. Yes, you're wasting energy that you don't need to be wasting. Yes, when you make changes, they might be harder than they need to be. But still, none of those might be in your top 10 worries.
Anne Currie: Yeah, it's true. you if the it really depends on on whether or not you really need that data that you're holding to be secure, is not necessarily it's not the case for all businesses. Sometimes it just doesn't matter. You be. that it's ⁓ but it's something you a lot about then was a big part of your job was strategy for performance for security strategy for resilience. It's like you need to know your business and know what matters and what doesn't matter. So that you know where it's really important that you put your attention and where actually doesn't matter so much.
Jon Berger: Yeah. Yeah. I mean, just, just at a basic level, are you, are you more obsessed with growing your top line or is it, you know, is it the bottom line that matters? Are you trying to just add more customers? Cause at the end of the day, you're in a growth, you're in a growth phase, you're in a growth business and way that the only, the only important way that that success is being measured is more customers or customers spending more money or top line revenue, in which case you're probably not going to be worrying about efficiency unless you're in an area where that efficiency is what drives customers. Or are you in a ⁓ relatively stable environment where you've ⁓ limited ability to drive that top line? and becoming more efficient can significantly increase your margins or lower your risks, and in which case that might be a very sensible thing for you to be doing.
Anne Currie: Now, on that point, we have now been talking for 40 minutes and been quite a dense discussion. So I feel at this point we should, for the being, draw this conversation to a close, ⁓ let people a think about what we said. We'll be, say, Jon is very cashed for this podcast and therefore will be on it quite often. So we can continue ⁓ this conversation. ⁓ I will, there will be show notes associated with this call, with this episode ⁓ ⁓ links in it ⁓ stuff that you can go away and look at and have a think about. Do, as usual, send in questions to me. I'm on LinkedIn. That's probably best place for you to send in comments and questions, things you would like us to be talking about and addressing in the podcast in the future. So I hope you've enjoyed the episode today. Thank you very much, Jon, for being a guest on asynchronous and unreliable. And will be seeing you and ⁓ all you again, hopefully very soon on future episode. Thank you very much and goodbye.
Jon Berger: Thanks