РАСШИФРОВКА 🔗
WEBVTT
00:00:00.000 --> 00:00:17.000
Hello, everybody. It is another episode of Runtime Arguments, and I cannot tell you how hard it was to start this episode. I'm Wolf, and as always, I'm recording with my best friend Jim. Jim, say hi.
00:00:16.000 --> 00:00:18.000
Hey Wolf, how you doing?
00:00:19.000 --> 00:00:34.000
Uh, better now. Today is the promised episode, our first episode with a guest. It is our genius friend from Meta, Marlon. Marlon, say hi.
00:00:33.000 --> 00:00:38.000
Hello everyone, I'm so glad to be here. Finally got this recording going.
00:00:34.000 --> 00:00:38.000
Hello, everyone. I'm so glad to be here.
00:00:38.000 --> 00:00:40.000
Finally got this recording going.
00:00:38.000 --> 00:00:41.000
Well, we're, we're glad to have you.
00:00:40.000 --> 00:01:00.000
This is… This is episode number 41, our 42nd episode, and um… why don't we start with a little feedback, which we love, and at the end of the show, we'll tell you how to send us some. I've got some feedback, Jim, do you?
00:00:59.000 --> 00:01:05.000
Uh, no, you know, I don't have any. I was busy this week, and I'm traveling, and I haven't heard from anybody.
00:01:07.000 --> 00:01:14.000
Uh, our friend Akana Peck, with whom I used to work, um, in fact.
00:01:14.000 --> 00:01:15.000
Ah.
00:01:15.000 --> 00:01:25.000
I have been programming in Python since, like, 1998 or something, and it was Akana who.
00:01:26.000 --> 00:01:35.000
hooked me up with Python. I didn't know anything about Python, or that it even existed, until Akana.
00:01:27.000 --> 00:01:29.000
Really?
00:01:35.000 --> 00:01:39.000
uh… turned my head to point in the right direction.
00:01:38.000 --> 00:01:40.000
Wow, that's amazing.
00:01:39.000 --> 00:01:46.000
And Akana had this opinion of us providing video.
00:01:47.000 --> 00:01:48.000
No.
00:01:49.000 --> 00:01:57.000
So, so we are, uh, that, that's two no and, and zero yes. So we are still 100% no.
00:01:58.000 --> 00:02:05.000
I would even call it 200%. Okay, not really.
00:02:04.000 --> 00:02:07.000
Yeah, math don't work that way.
00:02:05.000 --> 00:02:06.000
Umm.
00:02:07.000 --> 00:02:13.000
Yeah, it doesn't. You know, as the kids say, the math isn't mathing.
00:02:12.000 --> 00:02:13.000
Right.
00:02:13.000 --> 00:02:23.000
So that's about all the feedback. How was your week? And I guess we will get to ask Marlon how was his week. How was your week, Jim?
00:02:20.000 --> 00:02:38.000
Yeah, right. Well, this is the week that I'm traveling. I'm in Maine, Southwest Harbor, Maine. Years and years ago, back in the early 2000s when I was doing LTSP development, that's the Linux Terminal Server Project.
00:02:38.000 --> 00:02:42.000
Uh, we started having annual conferences in Southwest Harbor.
00:02:42.000 --> 00:03:15.000
And we would invite all our friends, and… and, uh, well, that's this week. Uh, so the… leading up to this week was preparing for it. And what I say is, it started out as a developer conference, but it… it is no longer a developer conference. It's, uh… I tell people this is more like deer camp, only no deer will be harmed. We show up, we bring tons of good food with us, and we stay in, like, an apartment. It's a suite with a full kitchen, and we cook wonderful, wonderful food.
00:03:15.000 --> 00:03:24.000
And, uh, so this past week was sort of getting all that stuff in order, um, for us to, uh, we arrived yesterday.
00:03:22.000 --> 00:03:31.000
You should mention how great the people who run the… I don't know if you call it a hotel or an inn.
00:03:27.000 --> 00:03:53.000
Oh, okay. Here's a, here's a plug for anybody who wants to visit Maine. Go to Southwest Harbor, uh, the Seawall Motel, and they have these three, uh, suites that are really apartments or condos, and we take over all three of them. And, uh, man, we just have such a good time. And, uh, Charlotte, the person who runs the, the… She's the proprietor, I guess. She's just wonderful.
00:03:53.000 --> 00:04:08.000
to us, and, and they give us sort of free reign of the entire place, and it's a blast. So, so here we are this week, and, um, uh, Marlon is here with us, so I'm gonna let him, uh, talk about how was his week, and, um, so yeah.
00:04:08.000 --> 00:04:17.000
Here I am. So yeah, I'm also here in Southwest Harbor. I've been here several times. It's always a pleasure to be back.
00:04:09.000 --> 00:04:25.000
So, yeah, I'm also here in Southwest Harbor. I've been here several times. It's always a pleasure to be back. By week, I just came from London. I go to London very often for work. I have a large team there.
00:04:17.000 --> 00:04:32.000
My week, I just came from London. I go to London very often for work. I have a large team there and it's always a pleasure like going see my folks there and all the colleagues and going out for dinner like every night. It's always a blast.
00:04:25.000 --> 00:04:40.000
And it's always a pleasure, like, going see my folks there and all the colleagues and going out for dinner, like, every night. It's always a blast. So this time, instead of flying back home, I just flew to Boston. I drove up here to Maine.
00:04:32.000 --> 00:04:36.000
So this time, instead of flying back home.
00:04:40.000 --> 00:04:43.000
We spend a couple of days with our friends here.
00:04:43.000 --> 00:04:45.000
It's a good week. How was your week, W.
00:04:48.000 --> 00:05:04.000
When I pick a place to work there's two main things that make me decide that and kind of a third thing. The two main things are am I going to work.
00:05:04.000 --> 00:05:19.000
With a team, uh, that shares my values and, you know, is pleasant to work with and, uh, are the kind of people I aspire to be or that I can and or that I can help become.
00:05:19.000 --> 00:05:29.000
Better at what they do, can they grow, can I grow, and the second thing is.
00:05:29.000 --> 00:05:35.000
Am I going to face problems outside my comfort zone?
00:05:35.000 --> 00:05:53.000
am I going to grow? Is there room for me to stretch?
Load full transcript
And the third thing is, can I move the needle? Especially for a lot of people. So, like Netscape, I got to move the needle. There were several places where I did that. And.
00:05:53.000 --> 00:06:11.000
Uh, there is a member of my team who is of a completely different discipline. Uh, he's our chief scientist, we call him Dr. Dave, he's a mathematician. Interestingly enough, uh, he grew up in the same town as me, Akron, Ohio.
00:06:11.000 --> 00:06:15.000
We have all the same friends, but.
00:06:15.000 --> 00:06:31.000
Um, Dave is a really, really good mathematician, uh, who can also program, and I'm a really, really good programmer, uh, who can pull out a calculator.
00:06:31.000 --> 00:06:46.000
So, every… every discussion I have with Dave is an opportunity for me to grow, and that is the thing that makes, uh…
00:06:33.000 --> 00:06:35.000
Okay.
00:06:46.000 --> 00:06:49.000
my job worthwhile.
00:06:49.000 --> 00:07:10.000
And I've been writing a program which I've discussed several times in episodes up to this. And there's a lot of math because it does estimation and it's about sampling and observation of traffic behavior and whatnot.
00:07:10.000 --> 00:07:27.000
And this is giving Dave so many things to teach me. My week has been 100% sterling because of what I'm learning. That makes me really, really happy.
00:07:27.000 --> 00:07:30.000
Oh! So.
00:07:30.000 --> 00:07:48.000
I feel like this was a pretty quick intro, which is good, because I'll bet, Marlon, you have a lot to say. So, this is our chance to, uh, get into the meat. Is there anything you need to say, Jim, before we…
00:07:48.000 --> 00:08:01.000
Yeah, I want to give Marlin a proper intro, more than we did at the top of the show. I mentioned LTSP back in the early 2000s.
00:07:48.000 --> 00:07:50.000
Hand it over to Marlon?
00:08:01.000 --> 00:08:07.000
I don't know, Marlon, what was it, 2002, 2003? 2002, 2003, that's when we met, I think.
00:08:04.000 --> 00:08:07.000
I was in churches of three, that's when we met, I think.
00:08:07.000 --> 00:08:21.000
Yeah, I, uh… we did a lot of our work on LTSP in an IRC channel, and one day, Marlon popped in and said hello, and he invited me to a conference down in Brazil.
00:08:10.000 --> 00:08:12.000
We've got a lot of hard work in LTSB.
00:08:21.000 --> 00:08:47.000
And, uh, I had been to Brazil the year before for a different conference, and I happily said yes. So, uh, I flew down to, um, uh, Porto Alegre, and, uh… uh, got to meet Marlin in person, and, uh, we did the conference. The conference was the, uh, uh, FISL, F-I-S-L? What did that stand for?
00:08:43.000 --> 00:08:47.000
Israel. Yeah. International Free Software Forum.
00:08:47.000 --> 00:08:49.000
International software forum.
00:08:47.000 --> 00:08:49.000
International software farm. Yeah.
00:08:49.000 --> 00:09:04.000
Yeah, and it was, uh, I think at the time, there were, like, 3 conferences around the world that were notable as being excellent. Um, there was, uh, FISL, uh, there was something in Australia, wasn't there? Uh, yes, in Fosden, still going on in Belgium.
00:08:50.000 --> 00:08:51.000
So.
00:08:51.000 --> 00:08:54.000
I think it doesn't like circumstances.
00:08:54.000 --> 00:08:55.000
World stuff, you know.
00:09:01.000 --> 00:09:05.000
Yes, and FOSDEM is still going on in Belgium.
00:09:05.000 --> 00:09:10.000
Yeah, yeah, FOSDEM in Belgium.
00:09:08.000 --> 00:09:10.000
And, um…
00:09:10.000 --> 00:09:22.000
uh, anyway, the conference was fantastic. Uh, uh, over the years, I went there several times. And, um, Marlon and I have, have become great, great friends. And in, um.
00:09:10.000 --> 00:09:14.000
It's fantastic.
00:09:22.000 --> 00:09:35.000
2012, he decided he wanted to move to the United States. And, uh, he, he applied at several places, and, and, uh, got a job working for Facebook, uh, now Meta.
00:09:35.000 --> 00:09:50.000
And, man, we're happy to have him here and here physically, too, here in Maine with us. So, yeah, he's been a great friend over the years. It's been a long time, and I'm enjoying every second of it.
00:09:39.000 --> 00:09:41.000
You don't realize the difference.
00:09:41.000 --> 00:09:43.000
It happens.
00:09:43.000 --> 00:09:49.000
So… Yeah, it's been a refund over the years, but it's been a long time.
00:09:50.000 --> 00:09:55.000
Um, so with that, Marlon, why don't you, yeah.
00:09:52.000 --> 00:09:57.000
Well, before before you hand it over, could I just append a tiny bit?
00:09:55.000 --> 00:09:56.000
Yeah.
00:09:56.000 --> 00:09:57.000
Oh, sure.
00:09:57.000 --> 00:10:09.000
Um, uh, both Jim and I have spoken at Thistle, and, uh, that is where I first met Marlon. And, um, Marlon has been…
00:10:03.000 --> 00:10:04.000
That's right.
00:10:09.000 --> 00:10:26.000
our friend for decades and has always proven to not just be our friend, but our peer and, you know, maybe better than a peer.
00:10:26.000 --> 00:10:35.000
He always has answers. And when it's questions, they're good questions, the right questions.
00:10:35.000 --> 00:10:52.000
Every interaction with Marlon is a pleasure and a privilege and a benefit. Jim and I have enjoyed this for quite some time and now you all will get to see some of it too.
00:10:52.000 --> 00:10:54.000
Thanks for being here, Marlin.
00:10:54.000 --> 00:11:03.000
Oh, that's my pleasure. I think we, well, thanks for all the words, the words and I think we're all good learners and I love.
00:10:54.000 --> 00:11:03.000
Oh, that's my pleasure. I think we… well, thanks for all the words, and I think we're all good learners, and I love…
00:11:03.000 --> 00:11:15.000
People that I when I talk to them, I learn something from them. And that's true when I talk to you both. And, and that's probably the reason that you're still my friend after so many years.
00:11:03.000 --> 00:11:15.000
people that I… when I talk to them, I learn something from them, and that's true when I talk to you both, and uh… and that's probably the reason that you're still my
friend after so many years.
00:11:15.000 --> 00:11:19.000
That's why you tolerate us.
00:11:15.000 --> 00:11:18.000
That's that's why.
00:11:18.000 --> 00:11:19.000
Good.
00:11:19.000 --> 00:11:27.000
Anyways, well, let's talk about efficiency. And before we go there, I want to start with the why.
00:11:19.000 --> 00:11:31.000
Anyways, well, let's talk about efficiency. And before we go there, I want to start with the why. I think there is this misconception that.
00:11:27.000 --> 00:11:31.000
I think there is this misconception that.
00:11:31.000 --> 00:11:40.000
efficiency is only important if you are running larger things, right? Which is not really true, and I want to go through some…
00:11:31.000 --> 00:11:40.000
efficiency is only important if you are running larger things, right? Which is not really true. And I want to go through some.
00:11:40.000 --> 00:11:42.000
There's some bullet points here.
00:11:40.000 --> 00:11:43.000
Through some bullet points here.
00:11:42.000 --> 00:11:54.000
And, uh, to try to convince you all listening to this episode, like, why… why this is important, not only for me working in large scale, but for probably anybody else working at any scale.
00:11:43.000 --> 00:11:56.000
And, uh, to try to convince you all listening to this episode, like, why… why this is important, not only for me working on scale, but for probably anybody else working at any scale. And, uh…
00:11:54.000 --> 00:11:56.000
And.
00:11:56.000 --> 00:12:02.000
Uh, I think I'm gonna start with mobile devices. So, uh, today…
00:11:56.000 --> 00:12:02.000
Uh, I think I'm gonna start with mobile devices. So, uh, today…
00:12:02.000 --> 00:12:05.000
I would say that the vast majority of.
00:12:02.000 --> 00:12:06.000
I would say that the vast majority of.
00:12:05.000 --> 00:12:12.000
interaction of people with computers happen through some mobile device, either a phone or an iPad.
00:12:06.000 --> 00:12:12.000
interaction of people with computers happened through some mobile device, either a phone or an iPad.
00:12:12.000 --> 00:12:24.000
And, uh, we can see that in numbers. Like, if you look at, uh, website traffic, uh, the vast majority of the interactions with most websites, uh, happen through mobile devices.
00:12:12.000 --> 00:12:31.000
And, uh, we can see that in numbers, like, if you look at, uh, website traffic, uh, the vast majority of the interactions with most websites, uh, happen through mobile devices. Which means that, even if we don't realize, when we develop software, we are developing software that is running.
00:12:24.000 --> 00:12:31.000
Which means that even if we don't realize when we develop software, we are developing software that is running.
00:12:31.000 --> 00:12:34.000
On, uh, on mobile devices.
00:12:31.000 --> 00:12:34.000
on mobile devices.
00:12:34.000 --> 00:12:35.000
You know, it could be a website.
00:12:34.000 --> 00:12:49.000
And it could be a website, like, it could be an actual application running on iOS or Google, etc. And those devices, they're pretty small, right, in terms of capacity as compared to a computer, right? And another big important thing is that most of those devices, they run on batteries.
00:12:49.000 --> 00:12:53.000
Right? And people don't like when you are draining their battery.
00:12:53.000 --> 00:13:09.000
And CPU uses a lot of battery, right? And so there's memory and other things on the device. So I think as a developer, like, you need to be conscientious, like, when you are running code on someone else's device, especially if that device is on battery.
00:13:09.000 --> 00:13:26.000
And, uh… It's very common that when people perceive some slowness, like in the applications, they're going to blame the applications, like, and not the phone or the iPad. Like, this app is slow. And that's usually something that's, like.
00:13:26.000 --> 00:13:29.000
The developer is accountable for that.
00:13:29.000 --> 00:13:44.000
It's also important to remember that not everybody is using a brand new phone, right? So a lot of people buy phones, and they're gonna keep those phones, like, for for several years, right? So it's very easy for us with a new phone to test something.
00:13:44.000 --> 00:14:08.000
and just assume that it works, and expect that thing to work the same way on something that, like, was built, like, 5 plus years ago. And, uh… So, that's on the mobile device. There's more reasons for where efficiency is important, like, uh, we may be developing something that runs on embedded systems, like, you guys are from Michigan, like, that's the auto industry there. So, there is a lot of computers running on cars now.
00:14:08.000 --> 00:14:24.000
And cars, they live for many, many years, like 20, 30 plus years. So if you're developing software that's going to run on any kind of embedded device, you should expect that embedded device to be the same hard device for several years, even though the software may be updated.
00:14:25.000 --> 00:14:38.000
So that's something to keep in consideration. Like, I mean, we develop software for TVs today and for several other embedded devices that are gonna be used for so many years, even though they have no chance to have any kind of, like, hardware upgrade.
00:14:39.000 --> 00:14:56.000
Uh, my favorite one is cloud, like, switching to cloud costs, like, cloud is really expensive in general, and it's very flexible, like, it's super convenient to run things on cloud, and I would say that I would probably assume that many listeners to this show.
00:14:57.000 --> 00:15:14.000
They host something on cloud, whether or not they're paying themselves or their employer is paying. Those costs can run away very, very quickly if we don't pay attention. CPU on cloud, you pay per hour.
00:15:14.000 --> 00:15:32.000
Like, you pay a lot for memory, you pay for storage, every time traffic moves from A to B, you are paying for that, and that really adds up. Like, when you see the costs, it may see a few cents
here, a few cents there, but when you run a larger system in cloud, like, those costs add up pretty quickly.
00:15:32.000 --> 00:15:46.000
And that's a pretty easy way to upset, like, whoever is managing the bill, like, which could be your employer or your client, if you're doing that as a service. So we'll talk more about that as we go through each of the efficiency things that I want to cover.
00:15:46.000 --> 00:16:03.000
But that's a big one. User experience in general, like, we do have, like, when I work, we have a lot of data correlating user experience with, like, latency and reliability in general, and it's very, very noticeable.
00:16:03.000 --> 00:16:19.000
that if we push a change to an app or any kind of interaction and the latency goes up, the engagement will go down. And that's not easy to understand why, right? And it's easy to understand why, because nobody likes to use something that's slow.
00:16:19.000 --> 00:16:25.000
Like, so you are gonna lose traction, like, you're gonna lose engagement if you have an app that's not behaving well.
00:16:25.000 --> 00:16:57.000
And, uh… I mean, there is many other, like… uh… angles that we can look at, uh… efficiency in general, like… like sustainability, and… and… efficiency in general, and, uh… reliability, so efficient systems, like… they're important, so you have more headroom if you have, like, traffic spikes, or… or anything like that. Like, so, uh… so that's essentially the why. I think, like, an episode like this is important, and talking about efficiency is important. Uh, one last thing on that.
00:16:57.000 --> 00:17:10.000
Efficiency is not performance, right? I think it's important to distinguish those two things. When you talk about efficiency, efficiency is a ratio, like how much I'm putting in versus how much I'm getting out.
00:17:10.000 --> 00:17:25.000
Right? Performance is like, how can I make this faster or better at any cost, right? So, for example, if I make something 20% slower, but it's now 10 times cheaper, that's an efficiency gain.
00:17:25.000 --> 00:17:33.000
And that's something that may be interesting. Like, you may have something that's faster than necessary, but it's costing you so, so much more.
00:17:33.000 --> 00:17:50.000
And so if you make it like slightly slower. But the cost, let's say a cloud bill goes down by 10 x like that may be a very good efficiency gain, even though you lost performance. But it's still good enough that nobody notices right? So I think that distinction is pretty important.
00:17:50.000 --> 00:17:52.000
Are you guys with me so far?
00:17:52.000 --> 00:17:54.000
Yeah.
00:17:55.000 --> 00:17:58.000
Okay. Yeah.
00:17:56.000 --> 00:18:00.000
Or are you talking to the listeners?
00:17:56.000 --> 00:17:58.000
Yeah, yeah.
00:17:59.000 --> 00:18:03.000
Oh, but, well, yeah. Well.
00:17:59.000 --> 00:18:03.000
Well, yeah.
00:18:00.000 --> 00:18:09.000
I don't know if you've done this before, but, like, a thing to know is the listeners don't
respond immediately.
00:18:03.000 --> 00:18:05.000
I'm… Mm-hmm.
00:18:03.000 --> 00:18:04.000
Right.
00:18:04.000 --> 00:18:05.000
Thank you.
00:18:06.000 --> 00:18:17.000
Oh, that's sad. Immediately. We'll see the feedback on that. It may take a week or two. Okay. Latency. So, so to you both, and any questions on the whys?
00:18:06.000 --> 00:18:11.000
Oh, that's it. Immediately. We'll see the feedback on the next.
00:18:11.000 --> 00:18:13.000
Right.
00:18:11.000 --> 00:18:17.000
Okay, and and so so to you both. And any question that is on the wise.
00:18:18.000 --> 00:18:24.000
Oh no, the Y is my life.
00:18:18.000 --> 00:18:21.000
No, it makes perfect sense.
00:18:21.000 --> 00:18:23.000
Yes.
00:18:23.000 --> 00:18:28.000
It makes perfect sense. Yeah.
00:18:28.000 --> 00:18:35.000
Okay, so in terms of topics, like I want to talk about…
00:18:28.000 --> 00:18:35.000
Yeah. Okay. So, so in terms of topics, like, I want to talk about.
00:18:35.000 --> 00:18:46.000
Mostly CPU, memory, IO, and storage, which is related, and networking, like moving bytes over the wire.
00:18:35.000 --> 00:18:45.000
Mostly CPU, memory, I/O, and storage, which is related, and networking, like moving.
00:18:45.000 --> 00:18:47.000
bytes over the wire.
00:18:46.000 --> 00:18:54.000
Right? And so before I talk any of these things, I want to talk about something that Wolf likes a lot, which is measurement.
00:18:47.000 --> 00:18:54.000
Right? And, uh, so before I talk any of these things, I want to talk about something that Wolf likes a lot, which is measurement.
00:18:54.000 --> 00:18:55.000
Like.
00:18:54.000 --> 00:18:56.000
Right.
00:18:55.000 --> 00:19:02.000
I know you like that. So let's start with that, because that's really important. And in my opinion.
00:18:56.000 --> 00:19:01.000
I know you like that. So let's start with that because that's really important.
00:18:57.000 --> 00:18:59.000
I do.
00:19:01.000 --> 00:19:03.000
And in my opinion.
00:19:02.000 --> 00:19:18.000
You really cannot optimize something that you don't measure, right? And if we're going to spend time and effort trying to optimize anything, I would suggest you that the first thing that you should do.
00:19:03.000 --> 00:19:13.000
you really cannot optimize something that you don't measure, right? And, uh, if you're gonna spend time and effort trying to optimize anything.
00:19:13.000 --> 00:19:21.000
I would suggest you that the first thing that you should do is to measure your problem.
00:19:18.000 --> 00:19:21.000
is to measure your problem.
00:19:21.000 --> 00:19:26.000
Right? So if you think that you have a CPU issue or an IO.
00:19:21.000 --> 00:19:26.000
Right? So if you think that you have a CPU issue, or an IO.
00:19:26.000 --> 00:19:42.000
You're installing or something. Try to measure that. How it really depends. But in general, most operating systems and application frameworks, they provide you all sorts of instrumentation.
00:19:26.000 --> 00:19:43.000
Are you stalling or something? Like, try to measure that. Like, how you really… It depends, but in general, like most operating systems and application frameworks, they provide you all sorts of instrumentation.
00:19:42.000 --> 00:19:44.000
Is that…
00:19:43.000 --> 00:19:44.000
that.
00:19:44.000 --> 00:19:49.000
can give you a lot of information that could be useful.
00:19:44.000 --> 00:19:49.000
Can give you, like, a lot of information that could be useful.
00:19:49.000 --> 00:19:59.000
How are we gonna store that? That's really up to you. There's, like, all sorts of interesting systems in the open source world. They have Prometheus, and InfluxDB, and…
00:19:49.000 --> 00:19:59.000
How we're gonna store that, that's really up to you. There's, like, all sorts of interesting systems in the open source world. They have Prometheus, and InfluxDB, and…
00:19:59.000 --> 00:20:19.000
anything. It really doesn't matter. Like, you can measure things on a text file. That's way better than not measuring at all, right? If you want to use something fancier, yeah, by all means. Like, when people are paying for fancier things, there are things like Splunk and other things, but I think that's beyond the scope.
00:19:59.000 --> 00:20:16.000
anything. It really doesn't matter. Like, you can measure things on a text file, that's way better than not measuring at all, right? If you want to use something fancier, yeah, by all means. Like, when people are paying for fancier things, there are things like Splunk.
00:20:16.000 --> 00:20:31.000
and other things. But I think that's beyond the scope here. But my point is like measure, right? Like you're, I'm sure that your application, your programming language, your operating system can provide you with a lot of interesting things that.
00:20:19.000 --> 00:20:34.000
But my point is, like, measure, right? Like, I'm sure that your application, your programming language, your operating system can provide you with a lot of interesting things that could be measured. Linux is really, really good for that.
00:20:31.000 --> 00:20:34.000
It could be Azure. Linux is really, really good for that.
00:20:34.000 --> 00:20:35.000
Okay.
00:20:35.000 --> 00:20:36.000
Okay.
00:20:35.000 --> 00:20:37.000
Let's start with CPU.
00:20:36.000 --> 00:20:38.000
So let's start with CPU.
00:20:38.000 --> 00:20:46.000
CPU is very, they're very fast. They're getting better, especially in number of cores.
00:20:38.000 --> 00:20:44.000
CPU is very, they're very fast, they're getting better.
00:20:44.000 --> 00:20:47.000
Like specially in number of chords.
00:20:46.000 --> 00:20:50.000
But they are finite, right? And.
00:20:47.000 --> 00:20:50.000
But they are finite, right? And uh…
00:20:50.000 --> 00:20:58.000
And especially in terms of speed, like, we've been around 2, 3 GHz for many, many years now.
00:20:50.000 --> 00:20:58.000
And especially in terms of speed, like we've been around two, three gigahertz for many, many years now.
00:20:58.000 --> 00:21:11.000
Like,
we're getting more cores, but not all applications can take benefit of that, right? Like, it's good from an operating system perspective, because you can run many applications at once, but if you're writing code that's, like, single-threaded code.
00:20:58.000 --> 00:21:11.000
Like, we're getting more cores, but not all applications can take benefit of that, right? It's good from an operating system perspective, because you can run many applications at once, but if you're writing code that's, like, single-threaded code.
00:21:11.000 --> 00:21:24.000
like, you are bound by how fast that card is. And, uh, you want… having 10 cores or 100 cores is not gonna get you anything, essentially. So I think when you are writing code, one thing that's…
00:21:11.000 --> 00:21:21.000
like, you… you are bound by how fast that card is. And, uh, you want… having 10 cards or 100 cards is not gonna get you anything, essentially.
00:21:21.000 --> 00:21:32.000
So I think when you are writing code, one thing that's important to understand is something that we called algorithm complexity, like or the big O notation.
00:21:24.000 --> 00:21:40.000
important to understand is something that we called algorithm complexity, like, or the big O notation, right? So, if I'm doing some code, and I'm going through an array, for example, right? What is the complexity, like, of that code?
00:21:32.000 --> 00:21:44.000
Right? So, if I'm doing some code, and I'm going through an array, for example, right? What is the complexity, like, of that code? Like, for example, if I'm iterating.
00:21:40.000 --> 00:21:44.000
Like, for example, if I'm iterating through…
00:21:44.000 --> 00:21:45.000
Through.
00:21:44.000 --> 00:21:52.000
all items of an array, and doing something with that element, like, so that's, uh, we call that our ON notation.
00:21:45.000 --> 00:21:52.000
all items of an array, and doing something with that element, like, so that's, uh, we call that our ON notation.
00:21:52.000 --> 00:21:54.000
Right? And, if we are.
00:21:52.000 --> 00:21:55.000
Right? And, uh, if we are…
00:21:54.000 --> 00:21:57.000
doing something…
00:21:55.000 --> 00:21:58.000
Doing something.
00:21:57.000 --> 00:22:14.000
like a hash map, for example. Like, that's a whole one notation. Like, there's many other types, like log n, or n squared, and etc. I'm not gonna go to all of those, that's not the point. But it's something that's important to understand when you are developing an algorithm, is that.
00:21:58.000 --> 00:22:08.000
like a hash map, for example, like, that's a Wo1 notation. Like, there's many other types, like log n, or n squared, and etc. I'm not gonna go to all of those, that's not the point.
00:22:08.000 --> 00:22:23.000
But it's something that's important to understand when you were developing an algorithm, is that how many passes I'm doing? Like, what is the actual cost of, like, going through an entire array, or if I have a two-dimensional arrays and all that?
00:22:14.000 --> 00:22:28.000
how many passes I'm doing? Like, what is the actual cost of, like, going through an entire array, or if I have a two-dimensional arrays and all that? And because you may be able to achieve the same thing.
00:22:23.000 --> 00:22:28.000
And because you may be able to achieve the same thing.
00:22:28.000 --> 00:22:31.000
with much less work.
00:22:29.000 --> 00:22:31.000
with much less work.
00:22:31.000 --> 00:22:41.000
And that's something that there is no right answer for everything when you're writing the code, but it's just something that you just need to think about it.
00:22:31.000 --> 00:22:41.000
And that's something that there's no right answer for everything when you're writing the code, but it's just something that you just need to think about it.
00:22:41.000 --> 00:22:42.000
Bye.
00:22:42.000 --> 00:22:45.000
Another thing related to that, like, not…
00:22:42.000 --> 00:22:46.000
Another thing related to that, like, not…
00:22:45.000 --> 00:22:50.000
When you're writing code, there's usually, like, very small.
00:22:46.000 --> 00:22:50.000
When you're writing code, there's usually, like, very small.
00:22:50.000 --> 00:22:55.000
parts of the code that are very hot. We call this a hot path.
00:22:50.000 --> 00:22:54.000
Parts of the code that are very hot. We call this the hot path.
00:22:55.000 --> 00:23:09.000
Right? And there's a lot of other things that your code may do that don't run very frequently, and uh… but there will be, like, sometimes a few lines of code here and there, and those things are gonna run really, really hot.
00:22:55.000 --> 00:23:10.000
Right? And, uh, there's a lot of other things that your code may do that don't run very frequently, and, uh, but there will be, like, sometimes a few lines of code here and there, and those things are gonna run really, really hot.
00:23:09.000 --> 00:23:19.000
Like, especially if you're doing computation. For example, imagine that you are iterating through an array, and for each element, you are doing some complex math.
00:23:10.000 --> 00:23:20.000
Like, especially if you're doing computation. For example, imagine that you are iterating through an array, and for each element, you are doing some complex math.
00:23:19.000 --> 00:23:29.000
Right? So the complex math will be the hot path. Like, that will be the thing that will take most of the the CPU time. And.
00:23:20.000 --> 00:23:22.000
Right? So the complex math.
00:23:22.000 --> 00:23:28.000
will be the hot path, right? That will be the thing that will take most of the CPU time.
00:23:28.000 --> 00:23:29.000
And, uh…
00:23:29.000 --> 00:23:34.000
And so one of the things that I would suggest in terms of that is that.
00:23:30.000 --> 00:23:34.000
So one of the things that I would suggest in terms of that is that.
00:23:34.000 --> 00:23:50.000
Try to keep your hot path as small as possible, right? And especially if you could run them or you could write them in a separate function and something that when you are
doing instrumentation, you are trying to measure like how much time I'm spending on that.
00:23:34.000 --> 00:23:50.000
Try to keep your hot path as small as possible. Right. And especially if you could run them or you could write them in a separate function and something that when you do instrumentation, you are trying to measure it like how much time I'm spending on that.
00:23:50.000 --> 00:24:02.000
It's very easy to know what's happening. For example, a file alert, for example, and et cetera. If you have that path in a piece of code, it's going to be very obvious how much time we're spending on that.
00:23:50.000 --> 00:24:03.000
Like, it's very easy to know what's happening. Like, if, for example, a filer, for example, and etc. And if you have that path in a piece of code, like, it's gonna be very obvious, like, how much time we're spending on that.
00:24:03.000 --> 00:24:05.000
In terms of…
00:24:03.000 --> 00:24:05.000
In terms of.
00:24:05.000 --> 00:24:08.000
Hot path, like, one thing that…
00:24:05.000 --> 00:24:08.000
Hot path, like, one thing that…
00:24:08.000 --> 00:24:12.000
You really need to answer, ask yourself, like, can I…
00:24:08.000 --> 00:24:12.000
You really need to answer, ask yourself, like, can I?
00:24:12.000 --> 00:24:18.000
parallelize this, right? Like, for example, if I'm doing a lot of.
00:24:12.000 --> 00:24:18.000
parallelize this, right? Like, for example, if I'm doing a lot of.
00:24:18.000 --> 00:24:22.000
Going through an array and doing a lot of computations.
00:24:18.000 --> 00:24:22.000
Going through an array and doing a lot of computations like.
00:24:22.000 --> 00:24:27.000
Sometimes you can't do things in parallel, but sometimes you can.
00:24:22.000 --> 00:24:27.000
Sometimes you can't do things in ParallelIO, but sometimes you can.
00:24:27.000 --> 00:24:43.000
And that changes the architecture of your code, right? So you may be able to take advantage of something like multi-threading, or multi-processing, or something like that, depends on the language that we're working.
00:24:27.000 --> 00:24:43.000
And that changes the architecture of your code, right? So you may be able to take advantage of something like multi-threading or multi-processing or something like that. Depends on the language that we're working.
00:24:43.000 --> 00:24:59.000
And then you can combine the result at the end. So for example, when you use something like FFmpeg to transcode a video, for example, right? So FFmpeg will break that job.
00:24:44.000 --> 00:24:49.000
and then you can combine the result at the end.
00:24:49.000 --> 00:25:01.000
Like, so for example, when you use something like FFmpeg to transcode the video, for example, right? So FFmpeg will break that job in many smaller jobs.
00:24:59.000 --> 00:25:04.000
in many smaller jobs, and it's going to do all of them in parallel.
00:25:01.000 --> 00:25:04.000
And it's gonna do all of them in parallel.
00:25:04.000 --> 00:25:15.000
And then essentially combine the result at the end. Some workloads, it's impossible to do that. Some workloads are serialized in nature, so you have to do one step after the other.
00:25:04.000 --> 00:25:07.000
And then essentially combine the result at the end.
00:25:07.000 --> 00:25:15.000
Some workloads, it's impossible to do that, right? Some workloads are serialized, like, in nature, so you have to do one step after the other.
00:25:15.000 --> 00:25:18.000
And there's no right or wrong. It really depends on the problem that we're solving.
00:25:15.000 --> 00:25:19.000
And there's no right or wrong, it really depends on the problem that you are solving.
00:25:19.000 --> 00:25:34.000
in terms of language here, you gotta be careful, right? For example, if you're using Python to do a lot of heavy work, heavy CPU work, multi-threading is pretty bad, because it has a global lock, so in that case, I would.
00:25:20.000 --> 00:25:25.000
In terms of language here, you gotta be careful, right? For example, if you're using.
00:25:25.000 --> 00:25:35.000
Python to do a lot of heavy work, heavy CPU work, multi-threading is pretty bad, because it has the global lock, so in that case, I would.
00:25:34.000 --> 00:25:41.000
suggest, like, go use some other language like Rust or C++ or Go that can actually do multi-threading.
00:25:35.000 --> 00:25:41.000
suggest, like, go use some other language like Rust or C++ or Go that can actually do multi-threading.
00:25:41.000 --> 00:25:58.000
you should know some things are changing about Python. All of the T versions have no global lock, but the thing about almost any language, um, is that.
00:25:50.000 --> 00:25:52.000
Mm-hmm.
00:25:58.000 --> 00:26:04.000
The languages usually don't make it easy for you to uh.
00:26:05.000 --> 00:26:21.000
Treat your data in a coherent and sane way across multiple threads. Nobody does it. Go is maybe one of the closest when it comes to who's going to help you the most.
00:26:11.000 --> 00:26:12.000
Right.
00:26:11.000 --> 00:26:13.000
Right. Yes.
00:26:13.000 --> 00:26:14.000
Yeah.
00:26:16.000 --> 00:26:17.000
Yes.
00:26:16.000 --> 00:26:18.000
Yes.
00:26:21.000 --> 00:26:36.000
uh, a lot of times the way out is not, uh, threads or, um, the easy kind of parallelization. Sometimes the easy way out is, uh.
00:26:31.000 --> 00:26:32.000
And this thing goes like this.
00:26:36.000 --> 00:26:44.000
Multiprocessing. Actually run your program five times where each one gets a separate slice.
00:26:37.000 --> 00:26:39.000
Yes?
00:26:37.000 --> 00:26:40.000
Yes?
00:26:40.000 --> 00:26:41.000
Yeah.
00:26:40.000 --> 00:26:41.000
Yep.
00:26:42.000 --> 00:27:01.000
Yes, I agree. Python does that really well. The multi-processing package can really help you to do that. The only thing that you got to be careful with multi-processing is that the inter-process communication becomes more expensive.
00:26:43.000 --> 00:27:06.000
Yes, I agree. Python does that really well, like, so the multi-processing, uh… package, right, can
really help you to do that. Yeah, the only thing that you got to be careful with multi-processing is that the inter-process communication becomes more expensive, like, because it's harder to take advantage of, like, shared slice of memory and things like that.
00:27:01.000 --> 00:27:15.000
it's harder to take advantage of, like, shared slice of memory and things like that. It can all be done, it's just something that requires a lot more knowledge, like, in terms of how to do it properly. But if you have.
00:27:06.000 --> 00:27:16.000
It can all be done. It's just something that requires a lot more knowledge in terms of how to do it properly. But if you have.
00:27:15.000 --> 00:27:20.000
A task where you can parallelize, and each piece.
00:27:16.000 --> 00:27:21.000
A task where you can parallelize, and each piece.
00:27:20.000 --> 00:27:28.000
doesn't need to talk to each other, multiprocess is perfect for that, because we're going to spend most of the time in the CPU.
00:27:21.000 --> 00:27:28.000
doesn't need to talk to each other, multiprocess is perfect for that, because we're going to spend most of the time in the CPU.
00:27:28.000 --> 00:27:32.000
Oh, and still on CPU, I think it's important that people…
00:27:29.000 --> 00:27:33.000
Oh, and still on CPU, I think it's important that people…
00:27:32.000 --> 00:27:35.000
Learn how to use profilers.
00:27:33.000 --> 00:27:35.000
Learn how to use profilers.
00:27:35.000 --> 00:27:51.000
like, Python has an excellent profiler, for example, like Cprofile, and Linux does Perf, and there's, like, other tools, like, on top of BPF that can do that, but understanding the concept of profiling in general, Profiler can answer you the question.
00:27:35.000 --> 00:27:49.000
Like, Python has an excellent provider, for example, like CPROFILE, and Linux has both, and there's, like, other tools, like… top of BPF that can do that, but understanding the concept of profiling in general.
00:27:49.000 --> 00:27:53.000
The profiler can answer you the question, such as…
00:27:51.000 --> 00:28:08.000
Such as… how… where am I spending most of my time in that code? Which functions? And etc. And then you can draw all sorts of, like, interesting visualizations of that, so it… that shows you the hot paths, because sometimes the hot paths are not obvious.
00:27:53.000 --> 00:28:08.000
how… where am I spending most of my time in that code? Which function? And etc. And then you can draw all sorts of, like, interesting visualizations of that, so it… that shows you the hot paths, because sometimes the hot paths are not obvious.
00:28:08.000 --> 00:28:11.000
And in profiling.
00:28:08.000 --> 00:28:11.000
and in profiling.
00:28:11.000 --> 00:28:24.000
of code, there is two concepts that you really need to understand. What's the difference between CPU time and wall time or clock time?
00:28:11.000 --> 00:28:22.000
of code, there is two, uh, concepts that you really need to understand. What's the difference between CPU time.
00:28:22.000 --> 00:28:24.000
and wall time, or clock time.
00:28:24.000 --> 00:28:35.000
Those are very different things. CPU time is the time that you are actually spending on the CPU, like the CPU is doing something for you.
00:28:24.000 --> 00:28:27.000
Those are very different things, right?
00:28:27.000 --> 00:28:42.000
CPU time is the time that you are actually spending on the CPU, like the CPU is doing something for you. Like, so all providers will answer you that question, right? So, for example, I may have a code.
00:28:35.000 --> 00:28:46.000
Like, so all providers will answer you that question, right? So… so, for example, I may have a code that takes 3 seconds of wallet time.
00:28:42.000 --> 00:28:47.000
that takes 3 seconds of wall time to run.
00:28:46.000 --> 00:28:50.000
It only spend half a second of the CPU.
00:28:47.000 --> 00:28:50.000
And it only spent half a second on the CPU.
00:28:50.000 --> 00:29:00.000
And then we may ask ourselves, where did the other two and a half seconds went? And that's wall time. And that's also really important to understand, because sometimes your code is slow.
00:28:50.000 --> 00:29:00.000
And then you may ask yourself, where did the other two and a half seconds went? And that's wall time. And that's also really important to understand, because sometimes your code is slow.
00:29:00.000 --> 00:29:12.000
you run top, for example, and your CPU is not at 100%, which means that your code is doing something else. I think the most correct way to say is your code is waiting for something else.
00:29:00.000 --> 00:29:12.000
you run top, for example, and your CPU is not at 100%, which means that your code is doing something else. I think the most correct way to say is your code is waiting for something else.
00:29:12.000 --> 00:29:15.000
And you need to understand, what is it waiting for?
00:29:12.000 --> 00:29:16.000
And you need to understand, what is it waiting for?
00:29:15.000 --> 00:29:31.000
It could be the network, it could be memory, it could be any other thing, like a disk, like I/O in general. It could be I/O. And it doesn't mean that the code is hot on the CPU. It's not at all. Like a profiler.
00:29:16.000 --> 00:29:34.000
Like, it could be the network, it could be memory, it could be… any other thing, like a disk, like I.O. in general, right? It could be I.O. And it doesn't mean that the code is hot on the CPU, it's not at all. Like, a profiler can really help you understand that.
00:29:31.000 --> 00:29:34.000
can really help you understand that.
00:29:34.000 --> 00:29:36.000
And, uh…
00:29:34.000 --> 00:29:36.000
And, uh…
00:29:36.000 --> 00:29:38.000
So, uh…
00:29:37.000 --> 00:29:39.000
So.
00:29:39.000 --> 00:29:42.000
Yeah, so that's CPU in general, right? So…
00:29:39.000 --> 00:29:43.000
Yeah, so that's CPU in general, right? So…
00:29:42.000 --> 00:29:51.000
Today, for example, with AI, Claude and Codex and things like that, they can really help you.
00:29:43.000 --> 00:29:49.000
Today, for example, with AI, Claude and Codex and things like that.
00:29:49.000 --> 00:29:51.000
They can really help you.
00:29:51.000 --> 00:30:05.000
like, make something more efficient, like, you can ask a piece of code and you can ask Claude, hey, look at this function, like, would you suggest me to write in a different way, or it can help you to profile and all that, so I'm a huge fan.
00:29:51.000 --> 00:29:57.000
like, make something more efficient, like, you can ask a piece of code and you can ask Claude, hey, look at this function.
00:29:57.000 --> 00:30:05.000
like, would you suggest me to write in a different way, or it can help you to profile and all that, so I'm a huge fan.
00:30:05.000 --> 00:30:15.000
of using AI to teach you, right? Also to write code, that's fine, but don't miss the opportunity to learn something while.
00:30:05.000 --> 00:30:12.000
of using AI to teach you, right? Also to write code, that's fine.
00:30:12.000 --> 00:30:16.000
Don't miss the opportunity to learn something while…
00:30:15.000 --> 00:30:20.000
Like you're using Claude or Codex, which could be super interesting.
00:30:16.000 --> 00:30:18.000
Like you're using Cloud or Codex, right?
00:30:18.000 --> 00:30:21.000
Which could be super interesting.
00:30:21.000 --> 00:30:24.000
Any questions on CPU before we talk about memory?
00:30:21.000 --> 00:30:25.000
Any questions on CPU before we talk about memory?
00:30:25.000 --> 00:30:27.000
I agree with everything you're saying.
00:30:27.000 --> 00:30:29.000
Okay.
00:30:30.000 --> 00:30:31.000
All right.
00:30:30.000 --> 00:30:31.000
All right.
00:30:30.000 --> 00:30:35.000
Well, you, you, you did leave out.
00:30:31.000 --> 00:30:32.000
Go ahead.
00:30:31.000 --> 00:30:33.000
Go ahead.
00:30:35.000 --> 00:30:47.000
like, CPUs, uh, and GPUs. I don't know if you… if that was a thing you wanted to touch on, or if, to you, you're just calling those all the same thing.
00:30:40.000 --> 00:30:41.000
Mm-hmm.
00:30:40.000 --> 00:30:41.000
Mmhm.
00:30:45.000 --> 00:30:53.000
It's not the same. I think that's a good comment. So, on the GPU side, I would say that.
00:30:46.000 --> 00:30:54.000
No, it's not the same. I think that's a good comment. So on the GPU side, I would say that.
00:30:54.000 --> 00:31:03.000
The majority of the people that I know that are developing applications, they are not writing code to run on GPU.
00:30:54.000 --> 00:31:02.000
The majority of the people that I know that are developing applications, they are not writing code.
00:31:02.000 --> 00:31:03.000
to run on GPUs.
00:31:03.000 --> 00:31:09.000
And because it's annoying, right? If you never wrote code, it's really annoying.
00:31:03.000 --> 00:31:09.000
And because it's a, it's a, it's annoying, right? If you never wrote code, it's, it's really annoy.
00:31:06.000 --> 00:31:08.000
It really is.
00:31:09.000 --> 00:31:19.000
But one thing that you need to be mindful of is that if you have access to GPUs, right, and you are writing.
00:31:09.000 --> 00:31:13.000
But one thing that you need to be mindful of.
00:31:13.000 --> 00:31:19.000
is that if you have access to GPUs, right, and you are writing.
00:31:19.000 --> 00:31:23.000
code that GPUs could be beneficial.
00:31:19.000 --> 00:31:23.000
code that GPUs could be beneficial.
00:31:23.000 --> 00:31:27.000
I think you are missing a tremendous opportunity of not using them.
00:31:23.000 --> 00:31:27.000
I think you are missing a tremendous opportunity of not using them.
00:31:27.000 --> 00:31:35.000
So there is only so much that you can do in GPUs. Because GPUs, they're a very interesting device. Like, they are…
00:31:27.000 --> 00:31:36.000
So, there is only… so much that you can do in GPUs. Because GPUs, they're a very interesting device. Like, they are…
00:31:35.000 --> 00:31:44.000
If you look from a core perspective, they're very slow. They're much, much lower than a normal CPU.
00:31:36.000 --> 00:31:38.000
If you look from a quarter.
00:31:38.000 --> 00:31:44.000
perspective. They're very slow. They're much, much lower than a normal CPU.
00:31:44.000 --> 00:31:51.000
The advantage is that you have tens of thousands. Like, I think a normal GPU today has 10, 12,000 cores.
00:31:44.000 --> 00:31:52.000
The advantage is that you have tens of thousands. Like I think a normal GPU today has 10, 12,000 cores.
00:31:51.000 --> 00:31:53.000
And.
00:31:52.000 --> 00:31:53.000
And, uh…
00:31:52.000 --> 00:32:04.000
Um, yes, when you're talking about, like, uh, NVIDIA cards or something. Uh, but if you're talking about, like, the GPUs that are…
00:31:59.000 --> 00:32:03.000
Yeah, exactly. Yeah, a laptop would be less.
00:31:59.000 --> 00:32:03.000
Yeah, exactly. Yeah, a laptop would be less.
00:32:04.000 --> 00:32:15.000
in a modern Macintosh with, uh, Apple Silicon. That's sort of a different problem. You don't get 10,000, you get 40.
00:32:07.000 --> 00:32:08.000
Mmhm.
00:32:15.000 --> 00:32:16.000
Mm-hmm.
00:32:15.000 --> 00:32:21.000
But the 40 that you get are a lot faster than that 10,000.
00:32:20.000 --> 00:32:21.000
Yeah.
00:32:21.000 --> 00:32:38.000
But you only get 40 of the identical thing. When you get the 10,000 on the NVIDIA card, there's like 3 different levels of what they are, and they're all dumb until the very, very top level, of which you only have, like.
00:32:25.000 --> 00:32:26.000
Yeah.
00:32:25.000 --> 00:32:26.000
Yah.
00:32:29.000 --> 00:32:31.000
Yes.
00:32:30.000 --> 00:32:31.000
Yes.
00:32:34.000 --> 00:32:35.000
Yeah.
00:32:35.000 --> 00:32:36.000
Yeah.
00:32:38.000 --> 00:32:40.000
It just made it, yeah.
00:32:38.000 --> 00:32:40.000
It does just mean, yeah.
00:32:39.000 --> 00:32:47.000
60 or something. But the Mac ones are faster and smarter, but you have so few.
00:32:40.000 --> 00:32:41.000
Yeah.
00:32:40.000 --> 00:32:42.000
Yeah.
00:32:45.000 --> 00:32:46.000
Yeah.
00:32:46.000 --> 00:32:47.000
Yep.
00:32:47.000 --> 00:32:56.000
But they do do, all of them, no matter who makes them, they do
do the one thing when the problem is…
00:32:49.000 --> 00:32:50.000
Yes.
00:32:51.000 --> 00:32:52.000
Right.
00:32:51.000 --> 00:32:52.000
Right.
00:32:56.000 --> 00:33:02.000
embarrassingly parallel, and it's math, and it's…
00:32:58.000 --> 00:32:59.000
Yeah.
00:33:02.000 --> 00:33:05.000
Not tremendously difficult math.
00:33:04.000 --> 00:33:05.000
Yeah.
00:33:04.000 --> 00:33:06.000
Yep.
00:33:05.000 --> 00:33:09.000
that you're on the right page. That's the thing.
00:33:08.000 --> 00:33:12.000
Yeah. Yeah. Totally agree. Yeah. It's. Yeah.
00:33:09.000 --> 00:33:24.000
Yeah, yeah, I totally agree. Yeah, it's a… Yeah, and one of the benefits of the Apple Silicon is the memory. Shared memory. You got shared memory between your regular CPU and your GPUs.
00:33:12.000 --> 00:33:17.000
One of the benefits of the is the the.
00:33:17.000 --> 00:33:23.000
Shared memory. Yes.
00:33:23.000 --> 00:33:25.000
So thank you.
00:33:24.000 --> 00:33:29.000
So that helps. That helps a lot, because when you're writing a GPU job.
00:33:25.000 --> 00:33:29.000
That helps a lot, because when you were writing a GPU job.
00:33:29.000 --> 00:33:40.000
Most of the time, wall time, you are spending loading data into the GPU and moving data out of the GPU. And we're spending less actual GPU time.
00:33:29.000 --> 00:33:37.000
Most of the time, wall time, you are spending loading data into the GPU and moving data out of the GPU.
00:33:37.000 --> 00:33:50.000
Like, and we're spending less actual GPU time, right? And Apple helps with that, because you have direct memory access, like, between the GPU and the CPU in the same actual.
00:33:40.000 --> 00:33:57.000
And Apple helps with that because you have direct memory access between the GPU and the CPU in the same actual physical allocation. The physical address is the same. And so that's very, very beneficial, which is not a case in large GPUs.
00:33:50.000 --> 00:34:00.000
physical allocation, right? The physical address is the same. And, uh, so that's very, very beneficial, which is not a case in large GPUs. So… Right. Anyway, good point. I think…
00:33:57.000 --> 00:34:00.000
So anyway, good point, I think.
00:34:01.000 --> 00:34:12.000
if you have access to a GPU, and your problem is, like, really a parallel problem, that you can solve a lot of the things, you can, let's say, apply a function.
00:34:01.000 --> 00:34:12.000
if you have access to a GPU, and your problem is, like, really a parallel problem, that you can solve a lot of the things, you can, let's say, apply a function.
00:34:12.000 --> 00:34:22.000
to a very large number of elements, like, it would be a map, like, on a language, right? On Python, Rust. Like, if your problem is a map problem.
00:34:12.000 --> 00:34:23.000
to a very large number of elements, like, it would be a map, like, on a language, right? On Python, Rust. Like, if your problem is a map problem.
00:34:22.000 --> 00:34:29.000
like with a very large array, a GPU is fantastic for that. And.
00:34:23.000 --> 00:34:28.000
like with a very large array, a GPU is fantastic for that, right?
00:34:28.000 --> 00:34:29.000
And, uh…
00:34:29.000 --> 00:34:37.000
Yeah, I don't have much experience myself with writing software for GPU other than just toying around.
00:34:30.000 --> 00:34:37.000
Yeah, I don't have much experience myself with writing software for GPU other than just toying around.
00:34:37.000 --> 00:34:46.000
And, uh, so that's as far as I can speak of GPUs. It can be a good answer for the problem they're trying to solve.
00:34:37.000 --> 00:34:46.000
And so that's as far as I can speak of GPUs. It can be a good answer for the problem they are trying to solve.
00:34:46.000 --> 00:34:49.000
It's they're just very annoying to to work with.
00:34:46.000 --> 00:34:49.000
They're just very annoying to work with.
00:34:51.000 --> 00:34:53.000
All right, let's talk about memory.
00:34:52.000 --> 00:34:54.000
All right, let's talk about memory.
00:34:53.000 --> 00:35:00.000
So before I talk about memory, one thing that I guess at this point most people know.
00:34:54.000 --> 00:35:00.000
So before I talk about memory, one thing that I guess at this point most people know.
00:35:00.000 --> 00:35:03.000
is about the cost of memory.
00:35:00.000 --> 00:35:03.000
is about the cost of memory.
00:35:03.000 --> 00:35:13.000
Like, memory, in terms of supply shortage for computers, memory is by far the component that's under the worst shortage.
00:35:03.000 --> 00:35:13.000
Like, memory, in terms of supply shortage for computers, memory is by far the component that's under the worst shortage.
00:35:13.000 --> 00:35:20.000
And, uh, most of this is driven by, uh, data center construction and all that, but, uh…
00:35:13.000 --> 00:35:20.000
And most of this is driven by data center construction and all that, but…
00:35:21.000 --> 00:35:24.000
It's been a problem since COVID, basically.
00:35:21.000 --> 00:35:24.000
It's been a problem since COVID, basically.
00:35:24.000 --> 00:35:26.000
Uh, today.
00:35:24.000 --> 00:35:27.000
Uh, today.
00:35:26.000 --> 00:35:33.000
I would say I don't have exact numbers, but just as a to have an idea, like if you build a rack of servers.
00:35:27.000 --> 00:35:33.000
I would say I don't have exact numbers, but just to have an idea, like if you build a rack of servers.
00:35:33.000 --> 00:35:37.000
About 75% of the cost of that rack is memory.
00:35:33.000 --> 00:35:38.000
About 75% of the cost of that rack is memory.
00:35:37.000 --> 00:35:44.000
Right? And and that's pretty crazy. Right? So what the takeaway for us.
00:35:38.000 --> 00:35:44.000
Right. And and that's pretty crazy, right? So what the takeaway for us.
00:35:44.000 --> 00:35:47.000
Here, like, as developers, is that…
00:35:44.000 --> 00:35:47.000
here, like, as developers, is that…
00:35:47.000 --> 00:35:48.000
We need to be…
00:35:47.000 --> 00:35:49.000
We need to be…
00:35:48.000 --> 00:35:51.000
Conscientious about using memory.
00:35:49.000 --> 00:35:51.000
Conscientious about using memory.
00:35:51.000 --> 00:36:04.000
Because it's, it's getting very expensive. It's getting, uh, not only is it expensive, but there is a shortage there. Like, so sometimes you, you may have the money to buy more, you just can't do it.
00:35:51.000 --> 00:35:58.000
Because it's, it's getting very expensive, it's getting, uh, not only is it expensive, but there is a shortage there.
00:35:58.000 --> 00:36:04.000
Like, so sometimes you, you may have the money to buy more, you just can't do it.
00:36:04.000 --> 00:36:20.000
Right? Like, when you're building a server, for example, like, the maximum amount of memory that, let's say, DAO or Supermicro is willing to sell you may be less than what you want. Right? And then the only thing that you have after that is essentially optimization. Like, how can I take…
00:36:04.000 --> 00:36:15.000
Right? Like, when you're building a server, for example, like, the maximum amount of memory that, let's say, DAO or Supermicro is willing to sell you may be less than what you want.
00:36:15.000 --> 00:36:21.000
Right, and then the only thing that you have after that is essentially optimization. Like, how can I take…
00:36:21.000 --> 00:36:26.000
the the most advantage of the memory that I can buy because I don't have more.
00:36:21.000 --> 00:36:25.000
the most advantage of the memory that I can buy, because I don't have.
00:36:26.000 --> 00:36:32.000
And the reality is that it is really possible. There is so much.
00:36:26.000 --> 00:36:33.000
Right. And the reality is that it is really possible. There is so much.
00:36:33.000 --> 00:36:48.000
a bad usage of memory, like when you were writing software, like memory leak, or maybe not a leak, but you were allocating memory for much longer than you need, and etc. And those things add up.
00:36:33.000 --> 00:36:46.000
a bad usage of memory, like when you were writing software, like memory leak, or maybe not a leak, but you were allocating memory for much longer than you need.
00:36:46.000 --> 00:36:54.000
And et cetera. And those things add up like over time, like a very common thing in many languages, like.
00:36:48.000 --> 00:36:55.000
Like, over time. Like, a very common thing in many languages, like, people allocate memory.
00:36:54.000 --> 00:36:56.000
People allocate memory.
00:36:55.000 --> 00:37:11.000
with a bunch of objects and data structures and not that, and the program keeps moving, and they never dereference that memory, right? And the memory just stays there for no reason, right? And I mean, the kernel has.
00:36:56.000 --> 00:36:59.000
With a bunch of odd jobs and data structures and not that.
00:36:59.000 --> 00:37:05.000
And the program keeps moving, and they never dereference that memory.
00:37:05.000 --> 00:37:15.000
Right. And the memory just stays there for no reason, right? And, uh… I mean, the kernel has some optimizations, if you have pages that.
00:37:11.000 --> 00:37:22.000
some optimizations. If
you have pages that haven't been used for several minutes, it may swap those pages and all that. But still, like, you are giving the operating system work.
00:37:15.000 --> 00:37:23.000
haven't been used for several minutes, it may swap those pages and all that. But still, like, you are giving the operating system work.
00:37:22.000 --> 00:37:27.000
Like to deal with those pages which may not be necessary.
00:37:23.000 --> 00:37:28.000
Like, to deal with those pages, which may not be necessary.
00:37:27.000 --> 00:37:41.000
Like, for example, if you go to a Linux and you run free, you may see that there's always some swap utilization, right? And you may wonder, like, why is this happening? So that's just a kind of doing optimization work.
00:37:28.000 --> 00:37:38.000
Like, for example, if you go to a Linux and you run free, you may see that there's always some swap utilization, right? And you may wonder, like.
00:37:38.000 --> 00:37:42.000
Why is this happening? So that's just the kernel doing optimization work.
00:37:41.000 --> 00:37:50.000
Like, and my take on this is that if you have a program running and they kind of decided that it could move a lot of pages to swap.
00:37:42.000 --> 00:37:51.000
Like, and my take on this is that if you have a program running and they kind of decided that it could move a lot of pages to swap.
00:37:50.000 --> 00:37:55.000
You should ask yourself, like, why are those pages allocated in the first place?
00:37:51.000 --> 00:37:55.000
You should ask yourself like why are those pages allocated in the first place?
00:37:55.000 --> 00:37:57.000
Like, should I…
00:37:55.000 --> 00:37:57.000
Like, should I…
00:37:57.000 --> 00:38:13.000
Take read of that. And that's something that as a developer, there's no right answer, but just something that you'd be conscious about. Don't hold up to memory more than what you need.
00:37:57.000 --> 00:38:08.000
Take read of that. Right. And and that's something that as a developer, like, there's no right answer, but it's some just something that you'd be conscious about.
00:38:08.000 --> 00:38:14.000
Like don't keep, don't hold up to memory like more than what you need.
00:38:13.000 --> 00:38:23.000
Right? And lots of systems have, like, Ethereum languages have, like, garbage collectors and all that. Like, like, you were.
00:38:14.000 --> 00:38:22.000
Right? And, uh, lots of systems have, like, programming languages have, like, garbage collectors and all that, like, like.
00:38:22.000 --> 00:38:23.000
You were.
00:38:23.000 --> 00:38:38.000
And they exist for a reason. You want to reclaim that memory that's not needed anymore. So give the garbage collector some work so it can free up that memory. And different languages have different strategies, but it's something to be careful.
00:38:24.000 --> 00:38:29.000
And they exist for a reason, like you want to reclaim that memory that's new.
00:38:29.000 --> 00:38:33.000
not needed anymore. So give the garbage collector some work so it
can free up that memory.
00:38:33.000 --> 00:38:39.000
And, different languages have a different strategies, but, but it's something to, to, to be careful.
00:38:39.000 --> 00:38:42.000
In terms of performance.
00:38:40.000 --> 00:38:42.000
In terms of performance.
00:38:42.000 --> 00:38:43.000
uh…
00:38:42.000 --> 00:38:44.000
Ah.
00:38:43.000 --> 00:38:49.000
When you talk about memory, like, there is the amount of memory that you are using.
00:38:44.000 --> 00:38:50.000
When you talk about memory, like, there is the amount of memory that you were using.
00:38:49.000 --> 00:38:58.000
like, the allocation, how long you hold that memory, and there is also the bandwidth problem. Like, how much memory are you all?
00:38:50.000 --> 00:38:58.000
Like the location, how long you hold that memory. And there is also the the bandwidth problem, like how much memory you all.
00:38:58.000 --> 00:39:10.000
you know, you are causing, like, how much you are riding, how much you are pulling back. And that's something that's important, like, to keep in mind when you are.
00:38:58.000 --> 00:39:10.000
IO, you are, you are causing, like, how much you are riding, how much you are, you are pulling back, and, and that's something that's important, like, to, to, to, to keep in mind when you are.
00:39:10.000 --> 00:39:14.000
Like doing cold, especially doing cold in the hot bath.
00:39:10.000 --> 00:39:14.000
Like, doing code, especially doing code in the hot path.
00:39:14.000 --> 00:39:18.000
Like for example, so let's say that you have an array.
00:39:14.000 --> 00:39:16.000
Like for example.
00:39:16.000 --> 00:39:19.000
Like, so let's say that you have an array.
00:39:19.000 --> 00:39:26.000
And you want to grow the array, right? Like, sometimes you may know in advance.
00:39:19.000 --> 00:39:26.000
And you want to grow the array, right? Like sometimes you may know in advance.
00:39:26.000 --> 00:39:30.000
a ballpark of how big that array is.
00:39:26.000 --> 00:39:28.000
a ballpark of.
00:39:28.000 --> 00:39:30.000
of how big that array is.
00:39:30.000 --> 00:39:38.000
It's much, much more beneficial in any programming language to pre-allocate that array.
00:39:30.000 --> 00:39:34.000
Right? It's much, much more beneficial.
00:39:34.000 --> 00:39:36.000
In any programming language.
00:39:36.000 --> 00:39:39.000
Pre-allocate the array.
00:39:38.000 --> 00:39:43.000
And, instead of, like, being.
00:39:39.000 --> 00:39:43.000
And, instead of, like, being.
00:39:43.000 --> 00:39:50.000
extending that array in the hot path. Like, every time you grow a structure.
00:39:43.000 --> 00:39:46.000
Extending that array in the hot path.
00:39:46.000 --> 00:39:50.000
Like every time you grow a structure.
00:39:50.000 --> 00:40:00.000
Right? In any language. Like, that's very, very expensive. Like, because the way the programming language does is by using the allocator, is by extending the heap.
00:39:50.000 --> 00:40:01.000
Right? In any language. Like, that's very, very expensive. Like, because the way the programming language does is by using the allocator, is by extending the heap.
00:40:00.000 --> 00:40:06.000
And that's expensive. Like, it creates a lot of churn that may not be necessary.
00:40:01.000 --> 00:40:06.000
And, and that's expensive. Like, it creates a lot of churn that may not be necessary.
00:40:06.000 --> 00:40:20.000
For example, if I know in advance that I need an array of a thousand elements, just do that right there. Because that extends the heap at that moment in one operation.
00:40:06.000 --> 00:40:14.000
Like, so for example, if I know in advance that I need an array of like a thousand elements, just do that right there.
00:40:14.000 --> 00:40:20.000
Like, because that extends the heap, like, at that moment, in one operation.
00:40:20.000 --> 00:40:35.000
Like if you do the same thing, let's say you are growing an array in a loop, right? When you start the loop, the language, the runtime really doesn't know how far you are going. So it's going to be extending that in the hot path as the loop is going.
00:40:20.000 --> 00:40:35.000
Like if you do the same thing, let's say you are growing an array in a loop, right? When you start the loop, the language, the runtime really doesn't know how far you are going. So it's going to be extending that in the hot path as the loop is going.
00:40:35.000 --> 00:40:37.000
That's a very, very common thing.
00:40:35.000 --> 00:40:38.000
That's a very, very common thing.
00:40:37.000 --> 00:40:45.000
and that when people are writing code they don't realize realize right? And.
00:40:38.000 --> 00:40:43.000
And that when people are writing code, they don't realize.
00:40:43.000 --> 00:40:46.000
Right. And, uh…
00:40:45.000 --> 00:40:54.000
In terms of if you go to, like, a lot of, like, even more optimization. Like, for example, if I have a very, very hot path.
00:40:46.000 --> 00:40:52.000
In terms of, if you go to, like, a lot of, like, even more optimization, like, for example.
00:40:52.000 --> 00:40:55.000
If I have a very, very hard path.
00:40:55.000 --> 00:41:11.000
And let's say I'm working with an array of structures, for example. It does make sense when I'm building my structures that I can get my hot data as close as possible together, so they land in memory next to each other.
00:40:55.000 --> 00:41:11.000
And let's say I'm working with an array of structures, for example, like it does make sense when I'm building my structures that I can get my hot data as close as possible together, like so they land in memory next to each other.
00:41:11.000 --> 00:41:22.000
And that helps caching a lot, right? Because the way the CPU cache works, it gives a lot of, uh, benefits when you have good memory locality.
00:41:12.000 --> 00:41:23.000
And that helps caching a lot, right? Because the way the CPU cache works, it gives a lot of benefits when you have good memory locality.
00:41:22.000 --> 00:41:30.000
Right, so if I have… let's say I have a struct, and
the struct has 20 elements, and I only really use…
00:41:23.000 --> 00:41:30.000
Right, so if I have… let's say I have a struct, and the struct has 20 elements, and I only really use…
00:41:30.000 --> 00:41:38.000
on the hot path of foreign elements. If you put those foreign elements together, you are most…
00:41:30.000 --> 00:41:36.000
On the hot path, four elements, right? If you, if you put those four elements together.
00:41:36.000 --> 00:41:39.000
Like you are more most.
00:41:38.000 --> 00:41:43.000
much more likely to have a cache hit when you're using those elements.
00:41:39.000 --> 00:41:44.000
Much more likely to have a cache hit when you're using those elements.
00:41:43.000 --> 00:41:45.000
And.
00:41:44.000 --> 00:41:45.000
And, uh…
00:41:45.000 --> 00:41:52.000
So it really makes sense to put them together, right? And there is many more.
00:41:45.000 --> 00:41:53.000
So it really makes sense to… to put them together, right? And there's many more.
00:41:52.000 --> 00:42:04.000
optimizations in terms of memory locality and et cetera. But in general, those are things that you need to keep in mind. Keep things together.
00:41:53.000 --> 00:42:01.000
optimizations in, in terms of like memory locality and et cetera, like, uh, and, uh, but, but in general, like, so those, those are things that you, you.
00:42:01.000 --> 00:42:04.000
You need to keep in mind, like keep keep things together.
00:42:04.000 --> 00:42:13.000
like when when you have a language that's like high level like Python. It's kind of hard to know what the runtime is actually doing.
00:42:04.000 --> 00:42:10.000
Like when, when you have a language that's like high level, like Python.
00:42:10.000 --> 00:42:13.000
It's kind of hard to know what the runtime is actually doing.
00:42:13.000 --> 00:42:19.000
But if you have the chance to work with a language where you have more control over that, like Rust.
00:42:13.000 --> 00:42:19.000
But, but if you have the chance to work with, with a language where you have more control over that, like Rust.
00:42:19.000 --> 00:42:27.000
it's much, much better, because you have much more control. Because most likely what you are doing is what we wind up in an assembly code.
00:42:19.000 --> 00:42:28.000
It's much, much better, because you have much more control, because most likely what you are doing is what will end up in an assembly code.
00:42:28.000 --> 00:42:29.000
Uh…
00:42:28.000 --> 00:42:30.000
Ah.
00:42:29.000 --> 00:42:31.000
Obviously be.
00:42:30.000 --> 00:42:31.000
Obviously beat.
00:42:31.000 --> 00:42:37.000
really careful about leaks. Like, so, what is a memory leak? Like, memory leak is that.
00:42:31.000 --> 00:42:37.000
really careful about leaks. Like, so what is a memory leak? Like, memory leak is that…
00:42:37.000 --> 00:42:42.000
Your memory allocation is growing and evergreen.
00:42:38.000 --> 00:42:42.000
Your memory allocation is growing and ever freeing.
00:42:42.000 --> 00:42:53.000
I would say 99% of the time, that's an accident, right? It was not intended, right? So, you allocated some data in a hot path, let's say we're looping through something.
00:42:42.000 --> 00:42:54.000
I would say 99% of the time, that's an accident, right? It was not intended, right? So… You were located some data in a hot path. Let's say you were looping through something.
00:42:53.000 --> 00:43:03.000
your memory is growing, and you're never to reference that, right? And then eventually, as I said before, you want to locate a memory that you don't need anymore.
00:42:54.000 --> 00:42:57.000
Your memory's growing, and you never do reference that.
00:42:57.000 --> 00:43:03.000
Right? And then eventually, as I said before, you are locating memory that you don't need anymore.
00:43:03.000 --> 00:43:07.000
And then it just stays there. Eventually the kernel may swap that out or not.
00:43:03.000 --> 00:43:08.000
And then it just stays there. Eventually, the kernel may swap that out or not.
00:43:07.000 --> 00:43:13.000
But it's just something that's there and needs to be dealt with.
00:43:08.000 --> 00:43:13.000
But it's just something that's there and needs to be dealt with.
00:43:13.000 --> 00:43:18.000
It's usually easy to find for long-running process, like if you watch…
00:43:13.000 --> 00:43:18.000
It's usually easy to find for long running process, like if you watch.
00:43:18.000 --> 00:43:28.000
the amount of memory that your processes are locating over time, you're gonna see something growing forever. Very, very common bug. It's really hard to track.
00:43:18.000 --> 00:43:28.000
the amount of memory that your process is allocating over time, you're gonna see something growing forever. Very, very common bug. It's really hard to track.
00:43:28.000 --> 00:43:43.000
in some languages, like, I think C and C++ is a good example, because the way memory is managed or not managed, right? Because you have to manage yourself. So if you, let's say, run malloc, and you do something with that.
00:43:28.000 --> 00:43:39.000
in some languages, like, I think C and C++ is a good example, because the way memory is managed or not managed, right? Because you have to manage yourself.
00:43:39.000 --> 00:43:50.000
So if you, let's say, run malloc, and you do something with that data, and you forgot to free, or your code branched something out somewhere else, right? That's a very common mistake.
00:43:43.000 --> 00:43:57.000
data, and you forgot to free, or your code branched somewhere else, right? That's a very common mistake. So languages like Rust help you so much on that, because of the concept of ownership and all that.
00:43:50.000 --> 00:44:02.000
So languages like Rust help you so much on that, because of the concept of ownership and all that. So it doesn't solve the problem completely, because you can still leak memory in Rust, but it's a lot less likely.
00:43:57.000 --> 00:44:07.000
So it doesn't solve the problem completely because we can still leak memory in REST, but it's
a lot less likely because the deallocation of memory is pretty much automatic.
00:44:02.000 --> 00:44:07.000
Because the deallocation of memory is pretty much automatic.
00:44:07.000 --> 00:44:08.000
Ah.
00:44:08.000 --> 00:44:22.000
In languages with garbage collector, you have to be really careful with reference counts. If you forgot to dereference something, the garbage collector will just never collect.
00:44:08.000 --> 00:44:14.000
In languages with garbage collector, you have to be really careful with reference counts.
00:44:14.000 --> 00:44:31.000
Like if you have, if you forgot to dereference something, the garbage collector will just never collect. And you have to be careful also with like cyclic references. Like let's say I have a struct that references another and that other struct references you back.
00:44:22.000 --> 00:44:33.000
And you have to be careful also with, like, cyclic references. Like, let's say I have a struct that references another, and that other struct references you back. If you do that.
00:44:31.000 --> 00:44:37.000
If you do that, you essentially are telling the garbage collector never collect this.
00:44:33.000 --> 00:44:37.000
You essentially are telling the garbage collector, never collect this.
00:44:37.000 --> 00:44:45.000
And that's a big, big problem. So if you are a Python programmer, learn about weak references.
00:44:37.000 --> 00:44:42.000
And, uh, and that's a big, big problem. So, if you were a Python programmer.
00:44:42.000 --> 00:44:52.000
Learn about weak references, which essentially solves that problem. You can do cyclic references, which sometimes it's pretty useful.
00:44:45.000 --> 00:44:55.000
And which essentially solves that problem. You can do cyclic references, which sometimes it's pretty useful, but you can do it in a safe way.
00:44:52.000 --> 00:44:55.000
But you can do it in a safe way.
00:44:55.000 --> 00:44:56.000
And, uh…
00:44:55.000 --> 00:44:57.000
And, uh…
00:44:56.000 --> 00:45:06.000
like, if you have a ring, for example, right? And you can build a ring in Python, but you have to use weak reference, because otherwise you are going to lock the garbage collector.
00:44:57.000 --> 00:45:06.000
like, if you have a ring, for example, right? And, uh, you can build a ring in Python, but you have to use weak reference, because otherwise you are gonna lock the garbage collector.
00:45:06.000 --> 00:45:15.000
And the Python is not going to complain because that may be what you want. And it's just not very smart.
00:45:06.000 --> 00:45:16.000
And the Python is not going to complain because that may be what you want, right? And it's just not very smart.
00:45:16.000 --> 00:45:19.000
uh… Terms of memory bandwidth.
00:45:17.000 --> 00:45:20.000
Temperatures of memory bandwidth.
00:45:20.000 --> 00:45:22.000
There is a…
00:45:21.000 --> 00:45:22.000
There is a.
00:45:23.000 --> 00:45:27.000
Very common misconception about memory.
00:45:23.000 --> 00:45:28.000
Very common misconception about memory.
00:45:27.000 --> 00:45:30.000
People think memory is really fast.
00:45:28.000 --> 00:45:30.000
People think memory is really fast.
00:45:30.000 --> 00:45:36.000
If you really think your memory is fast, I can give you a charge.
00:45:30.000 --> 00:45:36.000
if you really think your memory is fast, like, I can give you… I can give you a challenge.
00:45:36.000 --> 00:45:43.000
Like, go to your BIOS settings, disable the CPU cache, and run the operating system like that.
00:45:36.000 --> 00:45:43.000
Like, go to your BIOS settings, disable the CPU cache, and run the operating system like that.
00:45:43.000 --> 00:45:59.000
And then you're going to see how slower memory is, actually. So yes, memory is a lot faster than disk, even flash, SSD, and all that. But the reality is that it is orders of magnitude slower than whatever happens within the CPU.
00:45:43.000 --> 00:45:59.000
And then you're going to see how slower memory is actually. So yes, memory is a lot faster than disk, even flash, SSD and all that. But the reality is that it is orders of magnitude slower than whatever happens within the CPU.
00:45:59.000 --> 00:46:08.000
Like, especially your caches. So what I'm… the reason I'm saying for that is that when you're writing code that needs to be memory efficient, what that means.
00:45:59.000 --> 00:46:01.000
Like, especially your caches.
00:46:01.000 --> 00:46:08.000
So what I'm… the reason I'm saying for that is that when you're writing code that needs to be memory efficient, what that means.
00:46:08.000 --> 00:46:12.000
is that you really want to optimize for cache hits.
00:46:08.000 --> 00:46:13.000
Is that you really want to optimize for cache hits.
00:46:12.000 --> 00:46:16.000
Right. So you really want to make sure.
00:46:13.000 --> 00:46:16.000
So you really want to make sure.
00:46:16.000 --> 00:46:17.000
that.
00:46:16.000 --> 00:46:32.000
that if you're in the hot path, like that we're not creating a lot of cache misses. How do you know that? By measuring, right? So Linux has a lot of instrumentation that you can see per process, how many cache hits you have, how many cache misses.
00:46:17.000 --> 00:46:32.000
if you're in the hot path, like that you are not creating a lot of cache misses. How do you know that? By measuring, right? So Linux has a lot of instrumentation that you can see per process, how many cache hits you have, how many cache misses.
00:46:32.000 --> 00:46:42.000
And there are even profilers that can tell you that within the code, like if that path of the code is causing a lot of cache misses or not.
00:46:32.000 --> 00:46:42.000
And there are even profilers that can tell you that within the code, like if that path of the code is causing a lot of cache misses or not.
00:46:42.000 --> 00:46:45.000
Let me give you a very simple example.
00:46:42.000 --> 00:46:45.000
Let me give you a very simple example, right?
00:46:45.000 --> 00:47:00.000
imagine that you have, like, a spreadsheet, right? Like Excel,
for example, right? So, what that is in memory, it's a two-dimensional array, right? You have lines and columns. And let's say that you want to… you want to go through the whole thing, like, you want to…
00:46:45.000 --> 00:46:56.000
Imagine that you have, like, a spreadsheet, right? Like Excel, for example, right? So, what that is in memory, it's a two-dimensional array, right? You have lines and columns.
00:46:56.000 --> 00:47:00.000
And let's say that you want to… you wanna go through the whole thing, like, you wanna…
00:47:00.000 --> 00:47:08.000
iterate through the whole thing, like with a for loop or a while loop. There's two ways of doing that, right? You can do, let's say, line by line.
00:47:00.000 --> 00:47:08.000
Iterate through the whole thing, like with a for loop or a while loop. There's two ways of doing that, right? You can do, let's say, line by line.
00:47:08.000 --> 00:47:11.000
And then… and then column by column.
00:47:08.000 --> 00:47:11.000
And then column by column.
00:47:11.000 --> 00:47:16.000
The final result is the same. It really doesn't matter. You can do it each way.
00:47:11.000 --> 00:47:16.000
The final result is the same, it really doesn't matter, right? You can do it each way.
00:47:16.000 --> 00:47:17.000
But…
00:47:16.000 --> 00:47:17.000
Quiet.
00:47:17.000 --> 00:47:29.000
When you do that, if you profile, something's going to shock you. The performance difference between doing one way or another is really, really dramatic.
00:47:18.000 --> 00:47:29.000
When you do that, if you profile, something's gonna shock you. The performance difference between doing one way or another is really, really dramatic.
00:47:29.000 --> 00:47:32.000
And the reason for that is cash.
00:47:29.000 --> 00:47:32.000
And the reason for that is cash.
00:47:32.000 --> 00:47:37.000
And the reason for that, as I talked before, is memory locality.
00:47:32.000 --> 00:47:38.000
And the reason for that, as I talked before, is memory locality.
00:47:37.000 --> 00:47:40.000
When you build a two-dimensional array.
00:47:38.000 --> 00:47:40.000
When you build a two-dimensional array.
00:47:40.000 --> 00:47:45.000
Like, it's much, much faster to iterate their.
00:47:40.000 --> 00:47:50.000
Right? It's much, much faster to iterate their array in a way that you are reading the memory sequentially.
00:47:45.000 --> 00:47:51.000
array in a way that you are reading the memory sequentially other than.
00:47:50.000 --> 00:47:51.000
other than…
00:47:51.000 --> 00:48:05.000
doing the other way, and where they were jumping on the memory, right? And the reason for that is that it's the way cache works. Like, the way all the… it's called cache lines. Like, the way the cache lines work.
00:47:51.000 --> 00:48:05.000
doing the other way, and where you are jumping on the memory, right? And the reason for that is that it's the way cache works. Like, the way all the… it's called cache lines. Like, the way the cache lines work.
00:48:05.000 --> 00:48:07.000
When you read something from the memory.
00:48:05.000 --> 00:48:08.000
when you read something from the memory.
00:48:07.000 --> 00:48:11.000
Like, let's say you need 8 bytes from the memory.
00:48:08.000 --> 00:48:11.000
Like, let's say you need 8 bytes from the memory.
00:48:11.000 --> 00:48:27.000
the cache line is usually 64 bytes in a lot of CPUs, so the CPU is gonna read 64 bytes from that memory segment anyways, whether or not you only need one byte, right? Which means that if you read the next bytes.
00:48:11.000 --> 00:48:17.000
the cache line is usually 64 bytes in a lot of CPUs, so the CPU is gonna read.
00:48:17.000 --> 00:48:28.000
64 bytes from that memory segment anyways, whether or not you only need one byte, right? Which means that if you read the next bytes.
00:48:27.000 --> 00:48:35.000
like within the size of the cache line, that next read is going to be a cache hit, even though you never read that before.
00:48:28.000 --> 00:48:33.000
like within the size of the cache line, that next read is going to be a cache hit.
00:48:33.000 --> 00:48:35.000
Even though you never read that before.
00:48:35.000 --> 00:48:38.000
And so that's called.
00:48:35.000 --> 00:48:38.000
And so that's called…
00:48:38.000 --> 00:48:54.000
In computer science, it's called spatial optimization, right? And what we're putting things like located like one spatial locality like that.
00:48:38.000 --> 00:48:55.000
In, uh, computer science, that's called, uh… Uh, it's, uh, it's called spatial… spatial optimization, right? And what we're putting things like located like one spatial locality like that close.
00:48:54.000 --> 00:49:05.000
close to each other in a way that you just take advantage of the fact that cache lines, they are aligned in a certain number of bytes, and you can take advantage of that.
00:48:55.000 --> 00:49:05.000
to each other in a way that you just take advantage of the fact that cache lines, they are aligned in a certain number of bytes, and you can take advantage of that.
00:49:05.000 --> 00:49:26.000
Like, how do you know which way you have to read? Like, if you wrote this struct, you wouldn't know yourself because you wrote it. If you didn't write it, you should just profile. Like, for example, if you are building a code that's like navigating graphs or navigating two-dimensional arrays or three-dimensions or even more dimensions, like, can you see that?
00:49:05.000 --> 00:49:15.000
Like, how do you know which way you have to read? Like, if you wrote this struct, you would know yourself because you wrote it. If you didn't write it, you should just profile.
00:49:15.000 --> 00:49:20.000
My… for example, if you are… if you are building a code that's, like, navigating graphs.
00:49:20.000 --> 00:49:30.000
or navigating two-dimensional arrays, or three dimensions, or even more dimensions, like, and you see that, oh, I could write this this way or that way. Which way is the right one?
00:49:26.000 --> 00:49:31.000
Or I could write this
this way or that way. Which way is the right one? Just profile.
00:49:30.000 --> 00:49:32.000
Just per fire.
00:49:31.000 --> 00:49:47.000
You have to run multiple times. So let's say if you have an array that's small, like a thousand elements, if you profile, it's going to be microseconds. But what you can do is that on the profiler, ask the profiler to run that code like a million times.
00:49:32.000 --> 00:49:36.000
Like, you have to run multiple times, like, so, let's say.
00:49:36.000 --> 00:49:48.000
If you have an array that's small, like a thousand elements, like if you profile, it's gonna be microseconds. But what you can do is that on the profiler, ask the profiler to run that code like a million times.
00:49:48.000 --> 00:49:59.000
Because now you have a much better information coming out of the profiler. And so you can run that, oh, let's do it this way, let's do it a way, and see which way returns a better result.
00:49:48.000 --> 00:49:52.000
Because now you have a much better information coming out of the profiler.
00:49:52.000 --> 00:49:59.000
And, uh, so you can run that, oh, let's do it this way, let's do it that way, and see which way returns a better result.
00:49:59.000 --> 00:50:11.000
You may or may not want to understand why the difference is there, but that's really up to you. But what I'm saying is that at least pick the best one, like, even if you don't necessarily need to understand why it's better.
00:49:59.000 --> 00:50:05.000
You may or may not want to understand why the difference is there, but that's really up to you.
00:50:05.000 --> 00:50:11.000
But what I'm saying is that at least pick the best one, like even if you don't necessarily need to understand why it's better.
00:50:11.000 --> 00:50:12.000
And, uh…
00:50:11.000 --> 00:50:12.000
And.
00:50:13.000 --> 00:50:16.000
Okay, so let me look at my notes here.
00:50:13.000 --> 00:50:16.000
Okay, so let me look at my notes here.
00:50:16.000 --> 00:50:19.000
Okay. Any questions so far?
00:50:17.000 --> 00:50:19.000
Okay. Any questions so far?
00:50:21.000 --> 00:50:35.000
You know, when Wolf and I do these episodes, it's a lot more conversational because we have ideas and each of us come to it with our own set of knowledge.
00:50:35.000 --> 00:50:42.000
But today, with you talking, I just want to keep quiet and listen. Because that's how I'm going to learn.
00:50:41.000 --> 00:50:46.000
Okay, feel free to interrupt me if you have questions.
00:50:42.000 --> 00:50:46.000
Feel free to interrupt me if you have questions.
00:50:46.000 --> 00:50:58.000
Oh, you know I'm going to break in. But like you and I on this topic, we are very much on the same page.
00:50:49.000 --> 00:50:50.000
Mmhm.
00:50:58.000 --> 00:50:59.000
But.
00:50:59.000 --> 00:51:17.000
you're focusing in on each, uh, part as we go, uh, but you're gonna end up at, I feel like, the thing that I do. The thing that I do is I look at an entire system.
00:51:17.000 --> 00:51:34.000
and I figure out, um, what is it that the end user actually wants? And maybe the end user is, uh, my co-worker three cubes down. And maybe the end user is some person holding a phone.
00:51:34.000 --> 00:51:44.000
running an app, and maybe the end user is somebody's mother. Where is it that it costs.
00:51:44.000 --> 00:52:11.000
too much for them? Is it that it takes too long? That it, uh, actually uses too much money? That, um, it can't launch quick enough? Um… You're talking about each of the pieces, because the people you're talking to can understand the individual pieces, and you started with the right words. You started the whole talk with, you have a problem.
00:52:11.000 --> 00:52:19.000
The first thing you need to do is look at the whole problem, and figure out, in that whole problem.
00:52:19.000 --> 00:52:35.000
What's the real problem? What's the thing you're going to fight to make it better? And hearing you address each of the individual components, it is informing.
00:52:22.000 --> 00:52:24.000
The Y.
00:52:26.000 --> 00:52:27.000
Absolutely.
00:52:26.000 --> 00:52:27.000
Absolutely.
00:52:35.000 --> 00:52:50.000
and validating, and uh… you know, in me, you are preaching to the choir, and uh… I love a good session of somebody saying all the right words. I just love it.
00:52:42.000 --> 00:52:43.000
Mm-hmm.
00:52:49.000 --> 00:52:58.000
Okay, good. Thank you. So to finish with line, so I talk about like spatial performance, but I want to finish with…
00:52:50.000 --> 00:53:07.000
Good, thank you. So to finish with line, so I talk about spatial performance, but I want to finish with… something that we call temporal performance. What does that mean? A cache in general, like, it could be a CPU cache, or any kind of cache, like, it could be your browser cache.
00:52:58.000 --> 00:53:10.000
something that we call temporal performance. What does that mean? A cache in general, like, it could be a CPU cache, or any kind of cache, like, it could be your browser cache. They are based on something that's called.
00:53:07.000 --> 00:53:17.000
they are based on something that's called LRU, like Listen, Reset, Access, which means that the whole idea of a cache is that.
00:53:10.000 --> 00:53:17.000
LRU, like Listen, Reset, Access, which means that the whole idea of a cache is that.
00:53:17.000 --> 00:53:23.000
If you access something, it's quite likely that you are going to need that same thing soon after.
00:53:17.000 --> 00:53:24.000
If you access something, it's quite likely that you are going to need that same thing soon after.
00:53:23.000 --> 00:53:27.000
Right? So, so it's a, it's a bat, right?
00:53:24.000 --> 00:53:27.000
Right? So it's a bet, right?
00:53:27.000 --> 00:53:32.000
And you can take advantage of that. So, whenever you load data from…
00:53:27.000 --> 00:53:34.000
And you can take advantage of that. So whenever you load data from from memory, right? And.
00:53:32.000 --> 00:53:34.000
from memory, right? And.
00:53:34.000 --> 00:53:40.000
And the
CPU served you that, right? So this is the result of the…
00:53:34.000 --> 00:53:40.000
And and the CPU served you that right? So this is the result of the the.
00:53:40.000 --> 00:53:44.000
address that you were looking for. The CPU is going to cache that.
00:53:40.000 --> 00:53:44.000
address that you were looking for. The CPU is going to cache that.
00:53:44.000 --> 00:53:47.000
under the expectation that, hmm, you may need that again.
00:53:44.000 --> 00:53:56.000
under the expectation that, hmm, you may need that again. And in the next couple milliseconds or second, right? And so take advantage of that, right? For example.
00:53:47.000 --> 00:53:51.000
And in the next couple milliseconds or seconds, right?
00:53:51.000 --> 00:53:56.000
And, uh, so take advantage of that, right? For example.
00:53:56.000 --> 00:53:59.000
If you.
00:53:56.000 --> 00:54:04.000
uh… if you… If you were writing something.
00:54:00.000 --> 00:54:03.000
If you were… Write in something.
00:54:03.000 --> 00:54:15.000
Like this, gosh, there's so many examples there. Actually, let me give another interesting example of cache in general, like not just CPU cache. For example, imagine that you have a function.
00:54:04.000 --> 00:54:16.000
There's so many examples there. Actually, let me give another interesting example of cache in general, not just CPU cache. For example, imagine that you have a function.
00:54:15.000 --> 00:54:22.000
That's deterministic, which means that for a given input, it always gives you the same output.
00:54:16.000 --> 00:54:31.000
That's deterministic, which means that for a given input, it always gives you the same output, right? So most programming languages, they have caching functions, right, that you can cache that result without running the hot path.
00:54:22.000 --> 00:54:31.000
Right? So, most programming languages, they have caching functions, right? That you can cache that result without running the hot path.
00:54:32.000 --> 00:54:37.000
Like, so that's another example of, like, taking advantage of, like, temporal performance.
00:54:32.000 --> 00:54:47.000
So that's another example of taking advantage of temporal performance. And so you can think of that in terms of CPU cache. You can think of that in terms of computation. I really don't want to run this computation again.
00:54:37.000 --> 00:54:47.000
Right? And, uh, so you can do… you can think of that in terms of CPU cache, you can think of that in terms of, like, computation. Like, I really don't want to run this computation again.
00:54:47.000 --> 00:54:58.000
Right? So you can cache the result of that computation, like, somewhere. Let's say in memory somewhere. Which, by indirectly.
00:54:47.000 --> 00:54:55.000
Right, so you can cache the result of that computation, like, somewhere, let's say, in memory somewhere.
00:54:55.000 --> 00:54:58.000
Which by indirectly.
00:54:58.000 --> 00:55:02.000
You are going to take advantage of the CPU cache as well.
00:54:58.000 --> 00:55:02.000
you are gonna take advantage of the CPU cache as well.
00:55:02.000 --> 00:55:15.000
So let's imagine that you have a function that squares a number, right? So you have a function, the input is an integer, the output is another integer, for example, right? And then you call that function with number 2.
00:55:02.000 --> 00:55:15.000
So let's imagine that you have a function that squares a number, right? So you have a function, the input is an integer, the output is another integer, for example, right? And then you call that function with number two.
00:55:15.000 --> 00:55:18.000
Right, and then the return will be…
00:55:15.000 --> 00:55:18.000
Right, and then the return will be…
00:55:18.000 --> 00:55:29.000
2 squared, right, 4. And, uh, and let's say in Python, you can use something like functools.cache or functools.lru or something, right? So that result got cached.
00:55:18.000 --> 00:55:29.000
2 squared, right? 4. And, uh, and let's say in Python, you can use something like functools.cache or functools.lru or something, right? So that result got cached.
00:55:29.000 --> 00:55:36.000
So that decorator, that wrapper, stored that result in a… in a… in a…
00:55:29.000 --> 00:55:45.000
So that decorator, that wrapper stored that result in memory, right? Somewhere in memory, which if that's in the hot path and something's calling that like thousands and thousands of times per second.
00:55:36.000 --> 00:55:49.000
in memory, right? Somewhere in memory. Which, if that's in the hot path, and something's calling that, like, thousands and thousands of times per second, like, not only you are saving.
00:55:45.000 --> 00:56:00.000
Like, not only you are saving the CPU of redoing that calculation, you are also saving the CPU from re-accessing that memory segment, because that is in the CPU cache.
00:55:49.000 --> 00:55:57.000
the CPU of redoing that calculation, you are also saving the CPU from re-accessing that memory segment.
00:55:57.000 --> 00:56:00.000
Because that is in the CPU cache.
00:56:00.000 --> 00:56:13.000
Right? So, which means that if you have a loop, like a fork loop or something that's calling that function over and over and over and over, like, the result will come directly from the memory cache, which will be dramatically faster than.
00:56:00.000 --> 00:56:16.000
Which means that if you have a loop, like a for loop or something that's calling that function over and over and over and over, the result will come directly from the memory cache, which will be dramatically faster than either calculating that or fetching that from the main memory.
00:56:13.000 --> 00:56:20.000
either calculating that or fetching that from the main memory, right? Or worse yet, fetching that for swap. So this is…
00:56:16.000 --> 00:56:20.000
Right? Or worse, they are fleshing that for swastikas. Okay.
00:56:20.000 --> 00:56:29.000
This is a feature of the Python language. You can — Oh, most languages have that. Yeah. Okay. Yeah. Some languages call
it memoize. See? Yeah.
00:56:20.000 --> 00:56:22.000
Feature of the month.
00:56:22.000 --> 00:56:25.000
Oh, most languages have that, yeah.
00:56:25.000 --> 00:56:29.000
Yeah. Some language is called memo memoize. Yeah.
00:56:25.000 --> 00:56:30.000
Yeah, in Python, it's a decorator called memoize.
00:56:30.000 --> 00:56:43.000
Yeah, it's like memorize. Okay, okay, okay. So then the runtime knows to do that. One thing that you've got to be really careful. You can only memorize deterministic functions.
00:56:30.000 --> 00:56:34.000
Yeah, it's, like, memorized. Okay, okay, okay. Yeah, yeah.
00:56:35.000 --> 00:56:43.000
Yeah. Yeah. One thing that you gotta be really careful, you can only memorize deterministic functions.
00:56:44.000 --> 00:56:50.000
Okay, yeah, okay. Otherwise, you are gonna shoot yourself in the foot. Yeah, I, I, I…
00:56:45.000 --> 00:56:49.000
Otherwise, you are going to shoot yourself in the foot. Yeah.
00:56:47.000 --> 00:57:02.000
Yeah, you can memoize anything, but if you do memoize a function that isn't deterministic, you just made it deterministic and probably destroyed its value.
00:56:49.000 --> 00:56:50.000
Right.
00:56:50.000 --> 00:56:53.000
Yeah, yeah, you can. Yeah.
00:56:51.000 --> 00:56:53.000
Yeah, yeah, you can. Yeah.
00:56:54.000 --> 00:56:55.000
Yep.
00:56:56.000 --> 00:56:58.000
Right.
00:56:57.000 --> 00:56:58.000
Yeah. Right.
00:56:59.000 --> 00:57:06.000
Yes. Yeah. That's not what he wants. Sure. And, you know, I do a lot of Postgres.
00:56:59.000 --> 00:57:01.000
Yes. Yeah.
00:57:01.000 --> 00:57:04.000
That's not what he wants. Sure. Yeah.
00:57:05.000 --> 00:57:12.000
Yes. Yeah. Using Postgres, the historic procedures of Postgres when you create the function and.
00:57:06.000 --> 00:57:21.000
Development stuff, uh, using Postgres and stored procedures in Postgres. When you create the function and when you create the stored procedure, you say what the mutability is of that function. And if you say it's immutable, this is not whether you can write or not, right?
00:57:12.000 --> 00:57:16.000
When you create the stroke procedure, you say what the mutability is.
00:57:16.000 --> 00:57:21.000
Okay. Okay.
00:57:21.000 --> 00:57:40.000
Uh, when you say that this function is immutable, um, it means that it will always return, given these two inputs, it will always return the same outputs, always. Always. Uh, and there's, there's various levels. Uh, there's, there's, uh, stable, which means within the transaction, it'll always.
00:57:21.000 --> 00:57:24.000
Would you say that this function is sufficient?
00:57:26.000 --> 00:57:28.000
That means that it will always return.
00:57:30.000 --> 00:57:34.000
Yeah, yeah, always. So you can catch that there.
00:57:36.000 --> 00:57:39.000
Statement, which means within the transaction.
00:57:39.000 --> 00:57:43.000
Okay. Same result.
00:57:40.000 --> 00:57:56.000
produce the same result. And then, um, uh, I forget what the other settings are, there's 4 of them, um, and I
use them, and I make sure that I do it because I'm concerned with database performance, you know, with, uh, with accessing my data. And I guess it's the exact same thing.
00:57:43.000 --> 00:57:46.000
I forget what the other sentence are. There's 4 of them.
00:57:47.000 --> 00:57:49.000
that I understand, but I make sure that I, I don'.
00:57:56.000 --> 00:58:06.000
It is the same thing. By doing that, you are telling your signaling postgres what memoized techniques it can return.
00:57:56.000 --> 00:58:06.000
It is the same thing. By doing that, you are telling you're signaling Postgres what memorized techniques it can do internally.
00:58:06.000 --> 00:58:08.000
That's what we're doing, essentially.
00:58:06.000 --> 00:58:16.000
That's what we're doing, essentially. Right? And, so it's probably saving. So for a given input, what it does, it hashes the input.
00:58:08.000 --> 00:58:16.000
Yes, yes. So it's probably saving. So for a given input, what it does, it hashes the input.
00:58:16.000 --> 00:58:19.000
Right. And then it puts the result in a hash map.
00:58:16.000 --> 00:58:19.000
Right? And then it puts the result in a hash map.
00:58:19.000 --> 00:58:30.000
Which means that the next time you call, you are reading from the hash map. Right. Don't run the procedure. Going back to big O notation, it's an O1 operation.
00:58:19.000 --> 00:58:30.000
Which means that the next time you call, you are reading from the hash map. And the hash map, going back to big O notation, it's an O1 operation.
00:58:30.000 --> 00:58:38.000
Right. And you can read that really fast. And if you are reading that over and over and over and over within, the temporal space.
00:58:30.000 --> 00:58:38.000
Right? And you can read that really fast. And if you are reading that over and over and over and over within the temporal space.
00:58:38.000 --> 00:58:43.000
That means that most likely we're getting the result from the CPU cache instead of reading from the main memory.
00:58:38.000 --> 00:58:43.000
That means that most likely we're getting the result from the CPU cache instead of reading from the main memory.
00:58:43.000 --> 00:58:46.000
That has a huge, huge benefit.
00:58:43.000 --> 00:58:46.000
That has a huge, huge benefit.
00:58:46.000 --> 00:59:01.000
Right. And, a CPU cache in general, it's, mostly driven by, LRU, right? List recent usage. So the CPU will evict the cache if something else was read before. So that's why. Sure.
00:58:46.000 --> 00:59:01.000
Right. And a CPU cache in general, it's mostly driven by LRU, right, least recent usage. So the CPU will evict the cache if something else was read before. So that's why.
00:59:01.000 --> 00:59:07.000
The temporal efficiency only works well.
00:59:01.000 --> 00:59:06.000
the temporal efficiency is only works well.
00:59:06.000 --> 00:59:11.000
If in the hot path, you are not causing cash eviction.
00:59:07.000 --> 00:59:11.000
If in the hot path, you are not causing cash eviction.
00:59:11.000 --> 00:59:14.000
Right. And going back to something that I said before.
00:59:11.000 --> 00:59:14.000
Right? And going back to something that I said before.
00:59:14.000 --> 00:59:19.000
That's one of the main reasons to keep your hot path.
00:59:14.000 --> 00:59:23.000
That's one of the main reasons to keep your hot path as small as possible and as linear as possible.
00:59:19.000 --> 00:59:22.000
As small as possible, and as linear as possible.
00:59:22.000 --> 00:59:26.000
is to prevent evictions in the cache.
00:59:23.000 --> 00:59:26.000
is to prevent evictions in the cache.
00:59:26.000 --> 00:59:29.000
Sure. Because if you have a hot path.
00:59:26.000 --> 00:59:43.000
Because if you have a hot patch, for example, let's say you have a 10 megabyte of CPU cache and you have a hot patch that's causing 20 megabytes of memory churn, you are causing tremendous amount of eviction. You are never taking advantage of cache hits.
00:59:29.000 --> 00:59:46.000
For example, let's say you have a 10 megabyte of CPU cache and you have a hot patch that's causing 20 megabytes of memory churn. You are causing tremendous amount of eviction. You are never taking advantage of cache hits. Right, right. So sometimes it may make sense.
00:59:43.000 --> 00:59:58.000
So sometimes it may make sense that you split the hot path in two passes, and the first pass has a lot more cache hits because you are never evicting the cache. And on the second pass, you still have a lot more cache hits because you are not evicting the cache.
00:59:46.000 --> 01:00:03.000
that you split the hot path in two passes. And the first pass has a lot more cache hits because you are never evicting the cache. And on the second pass, you still have a lot more cache hits because you are not being destroyed by the previous piece of code that was leaking the cache. Right, right.
00:59:58.000 --> 01:00:03.000
being destroyed by the previous piece of code that was, like, evicted in the cache.
01:00:03.000 --> 01:00:07.000
Okay, so there's a couple of levels here. There's, um…
01:00:03.000 --> 01:00:08.000
Okay, so there's a couple of levels here. There's…
01:00:08.000 --> 01:00:23.000
caching the result of a function so that you don't have to call the function again. Yeah. That's, that's one level and that's always good. And then there's try to keep the results cache in the CPU. Yeah. So you don't even have to hit main memory anymore. Now you're right.
01:00:08.000 --> 01:00:15.000
caching the results of the functions. You don't have to call the function again. Yeah, yeah. That's, that's fine. That's good.
01:00:15.000 --> 01:00:17.000
Yes.
01:00:17.000 --> 01:00:20.000
Results cache in CPU.
01:00:22.000 --> 01:00:24.000
That's right.
01:00:23.000 --> 01:00:34.000
not only are you saving the function call, you're saving the memory fetch, and you're doing it as close to the CPU as you can. That's brilliant. Yeah, that's important. You can't control that directly.
01:00:25.000 --> 01:00:28.000
Yes, the
Maverick one.
01:00:28.000 --> 01:00:38.000
That's cost of CPU. Yes, yes, yes. Yeah, that's important. You can't control that directly, right? Because the operating system controls that, but you can influence that.
01:00:34.000 --> 01:00:38.000
Right? Because the operating system controls that, but you can influence that.
01:00:38.000 --> 01:00:55.000
And that's what I'm saying here. You can't really tell all CPU, don't evict this, don't evict that. No, the CPU will do what it's doing, but you can totally influence that. One thing to know when you have a CPU with multiple cores, there are a very small portion of the cache which.
01:00:38.000 --> 01:00:48.000
Right? And that's what I'm saying here. You can't really tell, oh, CPU, don't evict this, don't evict that. No, the CPU will do what it's doing, right? But you can.
01:00:48.000 --> 01:01:00.000
Like, one thing to know when you have a CPU with multiple cores, there are a very small portion of the cache which is per core, and there are more caches which are shared across.
01:00:55.000 --> 01:01:10.000
core, and there are more caches which are shared across multiple cores. So if you have a very heavily threaded system or a system running with multiple other processes, all their processes may be trashing your cache.
01:01:00.000 --> 01:01:11.000
multiple cores, right? So if you have a very heavily threaded system, or a system running with multiple other processes, all their processes may be trashing your cache.
01:01:10.000 --> 01:01:25.000
So that's something that you've got to be careful about. So you may have 20 megabytes of cache in the CPU. It doesn't mean that's yours. All the processes are competing with that. And that's one of the reasons that you don't control it.
01:01:11.000 --> 01:01:24.000
Right? So, that's something that you've got to be careful about, right? So, it… like, you may have 20 megabytes of cache in the CPU, it doesn't mean that's yours. Like, all the processes are competing with that, and that's one of the reasons that you don't control it, right?
01:01:25.000 --> 01:01:28.000
And, um, so anyway, uh…
01:01:25.000 --> 01:01:27.000
So anyway.
01:01:28.000 --> 01:01:38.000
So yeah, be careful with memory. Memory is slow. So be careful with memory churn in general.
01:01:28.000 --> 01:01:35.000
So yeah, be careful with memory. Memory is slow. Like, so be careful with memory churn.
01:01:35.000 --> 01:01:45.000
like, in general. Like, I think for… also for people working in languages like Rust and C++, where you have access to the stack and to the heap.
01:01:38.000 --> 01:01:50.000
also for people working in languages like Rust and C++, where you have access to the stack and to the heap, like, knowing the difference, right, I think that's really important.
01:01:45.000 --> 01:01:50.000
Like knowing the difference. Right. I think that's really important.
01:01:50.000 --> 01:01:53.000
My stack in general is much better.
01:01:50.000 --> 01:01:53.000
My stack in general is much better.
01:01:53.000 --> 01:02:00.000
if you know in advance how much memory you need, and it's not much, because otherwise you're gonna hit a stack overflow. But.
01:01:53.000 --> 01:02:01.000
if you know in advance how much memory you need, and it's not much, because otherwise you're gonna hit a Stack Overflow, but uh…
01:02:01.000 --> 01:02:09.000
It may be more beneficial to do all the work that we're doing in the stack, but if you have to go to the heap, because at some time you have to.
01:02:01.000 --> 01:02:10.000
It may be more beneficial to do all the work that we're doing in the stack, but if you have to go to the heap, because at some time you have to.
01:02:10.000 --> 01:02:12.000
Be conscientious about…
01:02:10.000 --> 01:02:13.000
Be conscientious about.
01:02:12.000 --> 01:02:19.000
how often you are extending the hip, right? That's why pre-allocation is really important. Like, for example.
01:02:13.000 --> 01:02:18.000
how often you are extending the hip, right? That's why pre-allocation is really important.
01:02:18.000 --> 01:02:20.000
For example.
01:02:19.000 --> 01:02:21.000
In Rust.
01:02:20.000 --> 01:02:21.000
In rest.
01:02:21.000 --> 01:02:23.000
when you create a string.
01:02:21.000 --> 01:02:23.000
when you create a string.
01:02:23.000 --> 01:02:36.000
like you, you you can tell Rust. I want a new string, and I want you to pre-allocate that with like 4 kilobytes, for example. So Rust extends the heat by 4 kilobytes at that call.
01:02:23.000 --> 01:02:25.000
Like you, you.
01:02:25.000 --> 01:02:37.000
you can tell REST, I want a new string, and I want you to pre-allocate that with, like, 4 kilobytes, for example. So REST extends the heap by 4 kilobytes at that call.
01:02:36.000 --> 01:02:48.000
Right? And then whether or not you use that, well, that's up to you. But you could tell it in advance, right? Because if you create a small string, and then you want to make it big later, that means that you have to.
01:02:37.000 --> 01:02:49.000
Right? And then whether or not you use that, well, that's up to you. But you could tell it in advance, right? Because if you create a small string, and then you want to make it big later, that means that you have to.
01:02:48.000 --> 01:03:01.000
cause a much more context switches, which to extend the hip and all that, and that gets really expensive. So, you can avoid a lot of the churn, if you know in advance, like, what you're doing, right?
01:02:49.000 --> 01:03:01.000
cause a much more to contact switches, which to extend the hip and all that, and that gets really expensive. So, you can avoid a lot of the churn, if you know in advance, like, what you're doing, right?
01:03:01.000 --> 01:03:04.000
Cool. Let's go to Ayo.
01:03:02.000 --> 01:03:04.000
Let's go to IO.
01:03:04.000 --> 01:03:06.000
So…
01:03:04.000 --> 01:03:21.000
Yeah, see, I'm doing a lot of work in JavaScript. We don't get to play those games. Yeah, maybe up to a certain point, yes, you're right, because a
lot of this thing is abstracted, right? But I don't know JavaScript much to have any opinions.
01:03:08.000 --> 01:03:23.000
Yeah, maybe up to a certain point, yes, you're right, because a lot of the things is abstracted, right? But I don't know JavaScript much to have any opinions, but there may be certain things where…
01:03:21.000 --> 01:03:25.000
There may be certain things where.
01:03:24.000 --> 01:03:31.000
It may be worth to profile. Let's say, for example, if you have a two-dimensional race and you have to go through the whole array.
01:03:25.000 --> 01:03:34.000
it's… it may be worth to profile. Let's say, for example, if you have a two-dimensional race, and you have to go through the whole array, right? Which order do you go? I don't know.
01:03:31.000 --> 01:03:37.000
Which order do you go? I don't know. Try both. Maybe we're going to be surprised.
01:03:34.000 --> 01:03:37.000
Try both. Like, maybe we're going to be surprised.
01:03:37.000 --> 01:03:39.000
Have a good day.
01:03:37.000 --> 01:03:42.000
The optimization I'm doing in JavaScript is, uh, how I access the DOM.
01:03:39.000 --> 01:03:41.000
Yeah. How can you access that?
01:03:42.000 --> 01:03:44.000
Mm-hmm. Yeah. Yeah.
01:03:42.000 --> 01:03:56.000
Yeah. You know, creating elements. Yeah. That's my hot path. That's a very good point. So let's say in the DOM, right? So DOM is a tree in memory, right? What is a graph? I think it's a tree in memory. Yeah.
01:03:44.000 --> 01:03:55.000
Yeah? That's a very good point. So let's say in the DOM, so DOM is a tree in memory, but it's a graph. I think it's a tree in memory.
01:03:55.000 --> 01:04:03.000
Right? So, there may be operations that you could optimize for… for…
01:03:56.000 --> 01:04:04.000
Right. So there may be operations that you could optimize for, for.
01:04:03.000 --> 01:04:10.000
complexity, like, for example, if I have ways to index the DOM that's, like, an O1.
01:04:04.000 --> 01:04:10.000
complexity, like, for example, if I have ways to index the DOM that's, like, an O1.
01:04:10.000 --> 01:04:14.000
or O log of N, if you have like a…
01:04:10.000 --> 01:04:15.000
Or, or, or log of n, if you have like a, like a…
01:04:14.000 --> 01:04:17.000
Uh, something like a binary search, for example.
01:04:15.000 --> 01:04:18.000
Something like a binary search, for example.
01:04:16.000 --> 01:04:31.000
like if you hash named nodes instead of search over and over again. It's super easy when you're dealing with the DOM to have horrifying quadratic functions. It was the case.
01:04:18.000 --> 01:04:21.000
If you, if you hash, yeah, exactly. Yeah.
01:04:18.000 --> 01:04:21.000
If you, if you hash, yeah, exactly, yeah.
01:04:21.000 --> 01:04:24.000
Yeah, exactly. Yeah. Yeah.
01:04:21.000 --> 01:04:24.000
Yeah, exactly. Yeah, yeah.
01:04:29.000 --> 01:04:31.000
Yes? Yeah?
01:04:29.000 --> 01:04:31.000
Yes, yeah.
01:04:31.000 --> 01:04:46.000
That very recently, a project called GreatDocs, which uses Quarto and is looking at your
actual documentation and has a DOM of its own.
01:04:46.000 --> 01:05:01.000
It was constantly… when it was building any kind of sidebar, like a table of contents, it was all quadratic operations, and so it took 20 minutes, even if your documentation was short.
01:04:59.000 --> 01:05:00.000
Yep.
01:04:59.000 --> 01:05:00.000
Yep.
01:05:01.000 --> 01:05:21.000
And I did a little profiling and filed a report that said, hey, look, you're doing a quadratic thing. You should probably do this instead. And they didn't use my exact code, but they thanked me for the profiling. And now, when I run the great docs operation on my code, it takes.
01:05:21.000 --> 01:05:24.000
24 seconds instead of 20 minutes.
01:05:22.000 --> 01:05:24.000
Yeah.
01:05:23.000 --> 01:05:31.000
Yeah, so it's really important that you mention that. So a quadratic problem is a notation of like O squared, right?
01:05:24.000 --> 01:05:36.000
Yeah, so it's really important that you mention that, so the quadratic problem is a notation of, like, ON squared, right? That's probably one of the worst things that you can do, and sometimes people may end up.
01:05:31.000 --> 01:05:39.000
That's probably one of the worst things that you can do, and sometimes people may end up… doing without realizing.
01:05:36.000 --> 01:05:39.000
doing without realizing.
01:05:39.000 --> 01:05:41.000
Right, and um…
01:05:39.000 --> 01:05:41.000
Right, and um…
01:05:40.000 --> 01:05:44.000
Almost always they don't realize.
01:05:41.000 --> 01:05:51.000
Almost always, because I don't think… I mean, there may be situations where ON square is what you wanted, is what you needed. Most of the times, you do that accidentally.
01:05:41.000 --> 01:05:51.000
Almost always, because I don't think… I mean, there may be situations where ON square is what you wanted, is what you needed. Most of the times, you do that accidentally.
01:05:51.000 --> 01:06:03.000
And, uh, and as anything that has an exponent, like, it's gonna grow exponentially, so you will notice very quickly is the difference of, like, seconds to several minutes, for example, right?
01:05:51.000 --> 01:06:03.000
And as anything that has an exponent, it's going to grow exponentially. So you will notice very quickly is the difference of seconds to several minutes, for example.
01:06:04.000 --> 01:06:05.000
All right.
01:06:04.000 --> 01:06:05.000
All right.
01:06:04.000 --> 01:06:16.000
Yeah, um, whenever you first approach a problem, um, your first answer is likely to look at the problem in the easiest way.
01:06:16.000 --> 01:06:32.000
And for some kinds of problems, the easiest way is, uh, oh, we'll test each of these against each of those. Well, now you're quadratic. You just said it. Right. Um, and it turns out.
01:06:27.000 --> 01:06:30.000
Yes, quadratic, yes.
01:06:27.000 --> 01:06:30.000
Use quadratic, yes. Mm-hmm.
01:06:32.000 --> 01:06:48.000
Some problems really are that bad, but if you have that problem, you already knew it. When your answer just
started that way, that was an accident and you can probably fix it.
01:06:45.000 --> 01:06:46.000
Yup.
01:06:45.000 --> 01:06:46.000
Yep.
01:06:48.000 --> 01:06:49.000
Yep.
01:06:48.000 --> 01:06:52.000
Yeah. Yeah. Another thing.
01:06:49.000 --> 01:06:51.000
Yeah, another thing.
01:06:51.000 --> 01:07:01.000
That's, to close a memory here is that if you have an array that you have a chance of make it sorted.
01:06:52.000 --> 01:07:01.000
That's, to close on memory here, is that if you have an array that you have a chance of make it sorted.
01:07:01.000 --> 01:07:11.000
right, and you need to find something there, you can use a binary search, where we're essentially bisecting that array over and over. And that changes your complexity from ON.
01:07:01.000 --> 01:07:11.000
right, and you need to find something there, you can use a binary search, where we're essentially bisecting that array over and over, and that changes your complexity from ON to.
01:07:11.000 --> 01:07:20.000
2o log of n, right? That makes a very, very significant difference in the median time to find what you were looking for.
01:07:11.000 --> 01:07:20.000
O log of N. That makes a very, very significant difference in the median time to find what we're looking for.
01:07:13.000 --> 01:07:15.000
Huh-huh.
01:07:21.000 --> 01:07:34.000
Of course, if you use hash maps and indexes on databases, like, you move that problem from ON, which is a full table scan, to O1, like, you go straight where you want.
01:07:21.000 --> 01:07:34.000
Of course, if you use hash maps and indexes on databases, you move that problem from ON, which is a full table scan, to O1. You go straight where you want.
01:07:34.000 --> 01:07:36.000
Oh one.
01:07:34.000 --> 01:07:35.000
Right. So that's why.
01:07:34.000 --> 01:07:36.000
Right, so that's why…
01:07:35.000 --> 01:07:37.000
Yeah, that's why you want index.
01:07:36.000 --> 01:07:38.000
Yeah, that's why you're running DAX.
01:07:36.000 --> 01:07:38.000
01 but amortized.
01:07:38.000 --> 01:07:39.000
Yep.
01:07:38.000 --> 01:07:39.000
Yeah.
01:07:39.000 --> 01:07:40.000
And, uh…
01:07:39.000 --> 01:07:41.000
And ah.
01:07:40.000 --> 01:07:46.000
Uh, Jim and I were talking about database indexes first, uh, before here, and uh…
01:07:41.000 --> 01:07:46.000
Jim and I were talking about database indexes first, before here.
01:07:46.000 --> 01:07:54.000
Which is really interesting, like they are a little bit more expensive to write when you were adding data to the database.
01:07:46.000 --> 01:07:58.000
Which is really interesting. They are a little bit more expensive to write when you were adding data to the database, but they give you a tremendous boost on the read side.
01:07:54.000 --> 01:08:06.000
But they give you a tremendous boost on the read side. So sometimes if you have a very write intensive database, you probably don't want too many indexes.
01:07:58.000 --> 01:08:13.000
Like, so sometimes if you have a very write intensive database, you probably
don't want too many indexes, but most of the times we write once and read many, like that's when indexes are great.
01:08:06.000 --> 01:08:13.000
But, uh, most of the times we write once and read many, like, that's when indexes are great.
01:08:10.000 --> 01:08:12.000
Mm-hmm.
01:08:13.000 --> 01:08:30.000
But indexes that are way bigger than the data can suck, like spatial indexes. If you're using PostGIS or something of that kind, you can put yourself in a situation where the index does not pay for itself.
01:08:18.000 --> 01:08:20.000
Oh yeah.
01:08:18.000 --> 01:08:20.000
Oh, yeah.
01:08:20.000 --> 01:08:21.000
Yeah.
01:08:20.000 --> 01:08:21.000
Yeah?
01:08:22.000 --> 01:08:24.000
Mmhm.
01:08:23.000 --> 01:08:24.000
Mm-hmm.
01:08:30.000 --> 01:08:32.000
Yah yah.
01:08:30.000 --> 01:08:32.000
Yeah, yeah.
01:08:30.000 --> 01:08:37.000
And when you're talking to new programmers, young programmers.
01:08:37.000 --> 01:08:43.000
Not new, uh, young. Like, they've only been doing stuff for 5 years, or whatever.
01:08:38.000 --> 01:08:40.000
Young.
01:08:39.000 --> 01:08:40.000
Yeah.
01:08:43.000 --> 01:08:59.000
They need to hear the most important thing, which is hash tables are the answer to almost all of the problems you face, whether it's a dictionary in your language or a hash or a whatever you call it.
01:08:57.000 --> 01:08:58.000
Mm-hmm.
01:08:59.000 --> 01:09:05.000
You need to be thinking about those. They answer a lot of problems.
01:09:02.000 --> 01:09:04.000
Yes.
01:09:03.000 --> 01:09:04.000
Yes.
01:09:04.000 --> 01:09:06.000
Absolutely.
01:09:04.000 --> 01:09:07.000
Absolutely. Yeah.
01:09:06.000 --> 01:09:08.000
Cool.
01:09:07.000 --> 01:09:10.000
Cool. Let's talk about IO.
01:09:08.000 --> 01:09:09.000
Let's talk about IO.
01:09:09.000 --> 01:09:11.000
YEAH!
01:09:09.000 --> 01:09:11.000
And, uh…
01:09:10.000 --> 01:09:18.000
And AIO is interesting. And the main reason that AIO is interesting, because it is so noticeable.
01:09:11.000 --> 01:09:18.000
Ayo is interesting. And the main reason that Ayo is interesting because it is so noticeable.
01:09:18.000 --> 01:09:27.000
Right? So, when I said, what I said before, right? Most people think that memory is incredibly, like, fast, right? Which, well…
01:09:18.000 --> 01:09:27.000
Right? So when when I said was I what I said before, right? Most people think that memory is incredibly, like, fast. Right? Which, well.
01:09:27.000 --> 01:09:42.000
Yeah, there's an argument there. But IO is obvious, right? And you really wanna be careful with IO, avoiding unnecessary IO. And people may have the counter argument today that, oh, now we're moving to SSDs and flashes, they are so much faster.
01:09:27.000 --> 01:09:43.000
Yeah, there's an argument there. But IO is obvious, right? And you really want to be careful with IO, avoiding unnecessary IO. And people may have the counter-argument today that, oh, now we're moving to SSDs and Flash, and they are so much faster.
01:09:43.000 --> 01:09:55.000
they are so much faster. They're still so much slower than memory. Like, it's still orders of magnitude slower. Like, so… and you really want to be careful with that. So, in terms of I.O.
01:09:43.000 --> 01:09:55.000
They are so much faster. They're still so much lower than memory. Like, it's still orders of magnitude slower. Like, so… and you really want to be careful with that. So, in terms of I.O.
01:09:55.000 --> 01:09:58.000
Uh, there is, uh…
01:09:55.000 --> 01:09:58.000
Uh, there is, uh…
01:09:58.000 --> 01:10:08.000
a lot of things that people need to understand when you are interacting with, like, block devices in general, like a disk, or an SSD, etc.
01:09:58.000 --> 01:10:09.000
a lot of things that people need to understand when they want interacting with, like, block devices in general, like a disk, or an SSD, etc. Like…
01:10:08.000 --> 01:10:09.000
Like.
01:10:09.000 --> 01:10:14.000
Especially with the spinning disks, which we still use a lot.
01:10:09.000 --> 01:10:13.000
Especially with spinning disks, which we still use a lot.
01:10:14.000 --> 01:10:16.000
for several workloads.
01:10:14.000 --> 01:10:27.000
for several workloads, right? The difference between sequential access versus random access. Like, so if you are writing a lot of data, right, it is beneficial to you that you write.
01:10:16.000 --> 01:10:26.000
Like, the difference between sequential access versus random access, like… So if you are writing a lot of data, right, it is beneficial to you that you write.
01:10:26.000 --> 01:10:32.000
Uh, things, like, in a sequential manner, as much as possible. Because that, not only is that…
01:10:27.000 --> 01:10:32.000
Uh, things, like, in a sequential manner, as much as possible. Because that, not only is that…
01:10:32.000 --> 01:10:36.000
faster to write, it will be faster to read later.
01:10:32.000 --> 01:10:51.000
faster to write, it will be faster to read later, right? And you can read much bigger blocks, like, you can read optimize for all sorts of, like, things, like, when you have good locality, very similar to memory, for different reasons, but very similar.
01:10:36.000 --> 01:10:51.000
Right? And, uh, you can read much, much bigger blocks, like, you can really optimize for all sorts of, like, things, like, when you have, uh, good locality, very similar to memory, for different reasons, but, uh, but, but very similar.
01:10:51.000 --> 01:10:53.000
The other thing…
01:10:51.000 --> 01:10:53.000
The other thing…
01:10:53.000 --> 01:11:03.000
in IO specifically, and memory also. I didn't talk about page size, but I'm gonna talk that in the context of IO. Like, when you're writing to a block device.
01:10:53.000 --> 01:11:03.000
in I.O. specifically, and memory also. I didn't talk about page size, but I'm gonna talk that in the context of I.O. Like, when you're writing to a block device.
01:11:03.000 --> 01:11:04.000
You.
01:11:03.000 --> 01:11:15.000
you… you never write or read one byte at a time.
Like, you read in blocks. Like, it's very common in Linux that use, like, 512-byte blocks, for example.
01:11:04.000 --> 01:11:14.000
You never write or read one byte at a time, like you read in blocks. Like it's very common Linux that use like 512 byte blocks, for example.
01:11:14.000 --> 01:11:17.000
But it may be beneficial.
01:11:15.000 --> 01:11:17.000
It may be beneficial.
01:11:17.000 --> 01:11:20.000
To do it much bigger. Like, uh…
01:11:17.000 --> 01:11:29.000
to do it much bigger. Like, at work, for file systems, we use 4K blocks, for example. And there's no right number for that.
01:11:20.000 --> 01:11:25.000
At work, we, for file systems, we use 4K blocks, for example.
01:11:25.000 --> 01:11:29.000
And there's no right number for that.
01:11:29.000 --> 01:11:45.000
Because if you use large blocks, yes, you can read a lot faster if you're reading a lot of stuff, but it can be a huge waste in terms of storage if all you need is to store 10 bytes, because you're not storing 10.
01:11:29.000 --> 01:11:43.000
Because if you use large blocks, yeah, you can read a lot faster if you're reading a lot of stuff, but it can be a huge waste in terms of storage if all you need is to store 10 bytes.
01:11:43.000 --> 01:11:49.000
Because you're not starting 10, you're starting 4K, right? And so there's no right.
01:11:45.000 --> 01:11:50.000
You were just starting 4K, right? And so it's there's no right.
01:11:49.000 --> 01:12:01.000
size, what the block that I want to work on, but it's just something that you need to make a conscious call, like, when you're making a decision, like, if I'm creating a file system.
01:11:50.000 --> 01:12:01.000
size with the block that I want to work on, but it's just something that you need to make a conscious call, like, when you're making a decision, like, if I'm creating a file system.
01:12:01.000 --> 01:12:12.000
What the size of my block? What does the underlying drive support? Like, some drives don't support more or less, for example, or if you have a remote storage system or something like that.
01:12:01.000 --> 01:12:13.000
What the size of my block? What does the underlying drive support? Like, some drives don't support more or less, for example, or if you have a remote storage system or something like that. Does it have something to…
01:12:12.000 --> 01:12:13.000
This is something to do.
01:12:13.000 --> 01:12:15.000
To be mindful.
01:12:14.000 --> 01:12:28.000
to be mindful. If you are doing writes, reads in general, right, be really careful of having small writes or small IO operations in general in the hot path, right? That's very expensive.
01:12:15.000 --> 01:12:26.000
if you are doing writes, or reads in general, right, be really careful of having small writes, or small IO operations in general, in the hot path.
01:12:26.000 --> 01:12:39.000
Right. That's very expensive for the your code because it's waiting and and for everything else underneath. Right. Let's say storage subsystem like or a local attached drive or something like that.
01:12:28.000 --> 01:12:42.000
for the… your code, because it's waiting, and for everything else underneath, right? Let's say, storage subsystem, like, or a local attached drive, or something like that, right? So, let's say you have a for loop.
01:12:39.000 --> 01:12:42.000
Right. So let's say you have a for loop.
01:12:42.000 --> 01:12:44.000
that you were reading…
01:12:42.000 --> 01:12:44.000
that you were reading.
01:12:44.000 --> 01:12:55.000
I don't know, let's say the worst case would be one byte at a time, right? And, uh, and we're reading that sequentially. That's incredibly more expensive than reading.
01:12:44.000 --> 01:12:55.000
I don't know. Let's say the worst case would be one bite at a time. Right? And and and we're reading that sequentially. That's incredibly more expensive than reading.
01:12:55.000 --> 01:13:02.000
a lot of bytes at a time, and then you deal with the slicing in memory.
01:12:55.000 --> 01:13:09.000
a lot of bytes at a time. And then you deal with the slicing in memory, which is much, much cheaper than doing that, trying to do the slice while you are doing the AO.
01:13:02.000 --> 01:13:09.000
Which is much, much cheaper than… doing that, trying to do these slides while you are doing the AO.
01:13:09.000 --> 01:13:19.000
Right? And, so be mindful of that, right? So every time you wish an IO, like the way it works, like your.
01:13:09.000 --> 01:13:19.000
Right? And, uh, so be mindful of that, right? So every time you issue an I.O, like, the way it works, like, your…
01:13:19.000 --> 01:13:22.000
Program will call a syscall.
01:13:19.000 --> 01:13:22.000
Program. We'll call a SIP call.
01:13:22.000 --> 01:13:37.000
Right? Which essentially transferred that to the kernel, which will cause the context switch right there. And the kernel, like, needs to talk to the system, to the driver, and to the actual hardware, and etc. And eventually that I…
01:13:22.000 --> 01:13:37.000
Right? Which essentially transferred that to the kernel, which will cause the context switch right there. And the kernel, like, needs to talk to the system, to the driver, and to the actual hardware, and etc. And eventually that…
01:13:35.000 --> 01:13:39.000
It's like a huge stack. It's very deep.
01:13:37.000 --> 01:13:43.000
It's a huge stack of stuff. Exactly. And, you know, every time you do I/O.
01:13:37.000 --> 01:13:43.000
It's a huge stack of stuff, exactly. And you know, every time you do I/O.
01:13:43.000 --> 01:13:45.000
The kennel knows.
01:13:43.000 --> 01:13:56.000
the kernel knows that that will take forever, like, from… relatively speaking, like, in kernel timelines. So what the kernel will do is that it will context switch you out, and it will do something else.
01:13:45.000 --> 01:13:56.000
that… that would take forever, like, from… relatively speaking, like, in kernel timelines. So what the kernel would do is that it will context switch you out, and you'll do something else.
01:13:56.000
--> 01:14:12.000
Right? Because it knows in advance that would take forever. And then eventually when the error is resolved, you are gonna get an interrupt that will essentially bring everything back together, right? And that releases the scheduler so the scheduler can schedule other work from a different process or from a different.
01:13:56.000 --> 01:14:12.000
Right? Because it knows in advance that it will take forever. And then eventually, when the error is resolved, you are going to get an interrupt that will essentially bring everything back together, right? And that releases the scheduler, so the scheduler can schedule all the work from a different process, or from a different.
01:14:12.000 --> 01:14:17.000
thread in in your own program. That's really, really, really expensive.
01:14:12.000 --> 01:14:17.000
thread in your own program. That's really, really, really expensive.
01:14:17.000 --> 01:14:28.000
Right. So that's why you really want to minimize the amount of IO that we're doing. And if you take, it can take advantage of like large writes and large reads, right? That makes, uh.
01:14:17.000 --> 01:14:29.000
Right. So that's why you really want to minimize the amount of IO that we're doing. And if it can take advantage of, like, large writes and large reads, right, that makes a big difference.
01:14:28.000 --> 01:14:29.000
Big difference.
01:14:31.000 --> 01:14:36.000
In terms of IO in general, that's more for writing code.
01:14:31.000 --> 01:14:36.000
In terms of I.O. in general, that's more for when they're writing code.
01:14:36.000 --> 01:14:41.000
Most languages now support asynchronous IO.
01:14:36.000 --> 01:14:41.000
Most languages now support asynchronous I/O.
01:14:41.000 --> 01:14:43.000
Right? And, uh…
01:14:41.000 --> 01:14:52.000
Right? And, I think there's a lot of people using that because it's easy and all that. But a lot of people don't understand what actually what that actually is.
01:14:43.000 --> 01:14:52.000
I think there's a lot of people using that, because it's easy and all that, but a lot of people don't understand what actually… what… That actually is.
01:14:52.000 --> 01:15:05.000
So in traditional I/O, if you write like a small C program, right, that will, let's say, open a file, read 10 bytes from the file and close the file. So those are syscalls, like open, read and close.
01:14:52.000 --> 01:14:56.000
So, in traditional IO, if you write, like, a small.
01:14:56.000 --> 01:15:06.000
C program, right? That will, let's say, open a file, read 10 bytes from the file, and close the file. So those are syscalls, like open, read, and close.
01:15:02.000 --> 01:15:03.000
I don't know.
01:15:06.000 --> 01:15:07.000
When you were.
01:15:06.000 --> 01:15:08.000
When you were…
01:15:08.000 --> 01:15:14.000
Whenever Cisco, when you run that Cisco, that thread blocks.
01:15:08.000 --> 01:15:14.000
Whenever Cisco, when you run that Cisco, that thread blocks.
01:15:14.000 --> 01:15:20.000
Right? You cannot run other
code, right, while it's blocked. It's not spending CPU time.
01:15:14.000 --> 01:15:29.000
Right? You cannot run other code, right, while it's blocked. It's not spending CPU time, right? Because the CPU essentially switches you out, and it's going to do something else. But that code is blocked. You cannot do anything else. Which means that.
01:15:20.000 --> 01:15:28.000
Right? Because the CPU essentially switches you out, and it's gonna do something else. But that code is blocked. You cannot do anything else.
01:15:28.000 --> 01:15:32.000
Which means that if you want to work with two files.
01:15:29.000 --> 01:15:32.000
If you want to work with two files.
01:15:32.000 --> 01:15:37.000
You have to have two threads, right? And so on, right?
01:15:32.000 --> 01:15:48.000
You have to have two threads, right? And so on, right? And that's also valid for network I/O, like a TCP socket or something like that. Every time you were writing or reading, you were blocking the thread. What async I/O is.
01:15:37.000 --> 01:15:46.000
that's also valid for network IO, like a TCP socket or something like that. It's like, every time you were writing or reading, you were blocking the thread.
01:15:46.000 --> 01:15:51.000
What async IO is, is that there are some.
01:15:48.000 --> 01:15:51.000
is that it… there are some…
01:15:51.000 --> 01:15:53.000
In some.
01:15:51.000 --> 01:15:53.000
Ink, some…
01:15:53.000 --> 01:15:55.000
Function some.
01:15:53.000 --> 01:15:55.000
some…
01:15:55.000 --> 01:16:01.000
I would say infrastructure in GDBC and et cetera that allows you.
01:15:55.000 --> 01:16:01.000
uh, I would say, infrastructure in GDBC and etc. that allows you.
01:16:01.000 --> 01:16:09.000
to deal with file descriptors in a way that you can do other things at once. Like if you.
01:16:01.000 --> 01:16:09.000
to… deal with file descriptors in a way that you can do other things at once. Like if you…
01:16:09.000 --> 01:16:13.000
You wanna know how that works? You should read about syscalls like SELECT.
01:16:09.000 --> 01:16:22.000
you want to know how that works, you should read about syscalls like SELECT, EPOL, which is the one they use today, right? And that's how it's done. But essentially, it allows you to deal with an.
01:16:13.000 --> 01:16:22.000
EPOL, which is the one they use today, right? And that's how it's done. But essentially, it allows you to deal with an.
01:16:22.000 --> 01:16:33.000
very large number of file descriptors, uh, in the same thread, right? Uh, and then, and then while you're waiting, your program could be doing some other things.
01:16:22.000 --> 01:16:38.000
Very large number of file descriptors in the same thread. And then while you're waiting, your program could be doing some other things. So most modern languages have all sorts of abstractions.
01:16:33.000 --> 01:16:48.000
Right? So most modern languages have all sorts of abstractions on that, and that's something that you absolutely need to take advantage of, because then you can make your single-threaded programs.
01:16:38.000 --> 01:16:53.000
on that. And that's something that you absolutely need to take advantage of because then you can make your single threaded programs so much more efficient because you are not blocking the thread on I/O.
01:16:48.000 --> 01:16:59.000
So much more efficient because you are not blocking the thread on on IO. The only way that you could do that in the past was by using multi threading, which is very inefficient.
01:16:53.000 --> 01:17:06.000
The only way that you could do that in the past was by using multi-threading, which is very inefficient. If you are spawning a new thread just because you need to do parallel IO, you are doing something wrong.
01:16:59.000 --> 01:17:06.000
If you are spawning a new thread just because you need to do parallel IO, you are doing something wrong.
01:17:06.000 --> 01:17:22.000
Like you should not do that. And Python helps with that with async functions and all that. REST has Tokio. This is where JavaScript really shines. JavaScript is excellent. JavaScript with Node for server things? Yes. It's wonderful.
01:17:06.000 --> 01:17:16.000
Like, you should not do that. And Python helps with that, with async functions and all that. The rest has Tokyo and etc.
01:17:16.000 --> 01:17:20.000
JavaScript is excellent on that because it is asynchronous by design.
01:17:20.000 --> 01:17:22.000
Yes.
01:17:22.000 --> 01:17:33.000
Yes, they're very good. Most of the things are single threaded. JavaScript is single thread, right? And not sure about Node, but I'm assuming it is for a request.
01:17:22.000 --> 01:17:35.000
Yes, they're very good. Most of these things are single threaded. JavaScript is single thread, right? And not sure about Node, but I'm assuming it is. It's single threaded unless you create a worker thread. Yeah.
01:17:33.000 --> 01:17:34.000
Yeah.
01:17:34.000 --> 01:17:35.000
Yeah.
01:17:35.000 --> 01:17:39.000
But is a water thread another extra thread?
01:17:35.000 --> 01:17:39.000
But is a worker thread or not another actual thread?
01:17:39.000 --> 01:17:47.000
Yes. Okay, okay. Because in Python, if you have an async and you create, like, a new coroutine, for example, like, that's not another thread.
01:17:39.000 --> 01:17:49.000
Yes. Okay. Because in Python, if you have an async and you create a new coroutine, for example, that's not another thread. It's another…
01:17:47.000 --> 01:18:02.000
It's another… they call it light… each language calls it different, like, lightweight threads, but they all run in the same thread. Yeah, I haven't really looked closely under the hood, but my understanding is they're all separate threads. Yeah, if it's a separate thread, you can do…
01:17:49.000 --> 01:17:54.000
They call light each language calls it different, like lightweight threads, but they're all running the same thread.
01:17:59.000 --> 01:18:15.000
Yeah, if it's a separate thread, you can do parallel CPU work and it will actually be parallel.
That's the difference between concurrency and parallelism. Parallelism, you actually have two things happening literally at the same time.
01:18:02.000 --> 01:18:07.000
parallel CPU work and it will actually be parallel.
01:18:07.000 --> 01:18:19.000
Like that's the difference between concurrency and parallelism, right? Parallelism, you actually have two things happening literally at the same time. Right. Like with asyncio, nothing happens at the same time.
01:18:15.000 --> 01:18:29.000
Like, with async IO, nothing happens at the same time, right? It just looks like that, but everything is still serialized within the thread. It is just that that complexity is managed by…
01:18:19.000 --> 01:18:29.000
Right, right. It just looks like that. But everything is still serialized within the thread. It is just that that complexity is managed by.
01:18:29.000 --> 01:18:43.000
something else, in case of FIFO. JavaScript avoids the number one problem, and that is concurrency and sharing memory. The threads don't share memory at all. It's all message passing. Okay.
01:18:29.000 --> 01:18:33.000
something else. In case of Python, we'll do the IC code at the same time.
01:18:35.000 --> 01:18:37.000
This is a confirmed receipt.
01:18:37.000 --> 01:18:40.000
Mm-hmm.
01:18:40.000 --> 01:18:41.000
Yes.
01:18:41.000 --> 01:18:51.000
Okay. Okay. Okay. That's the right way of doing. That's what I think Rolf mentioned before. Go is excellent in that with channels.
01:18:44.000 --> 01:18:52.000
That's the right way of doing. That's what I think Rolf mentioned Go before. Go is excellent in that with channels. Yeah, yeah.
01:18:52.000 --> 01:18:59.000
Okay, so we talked a little bit about database. There's two things on database, like we did talk about indexes.
01:18:52.000 --> 01:19:05.000
Okay, so we talked a little bit about database. There's two things on database. We did talk about indexes. There's another thing that I want to talk about, which usually is called the n plus one priority problem.
01:18:59.000 --> 01:19:05.000
Uh, there's another thing that I want to talk about, which is, uh, usually it's called the N+1 query problem.
01:19:05.000 --> 01:19:07.000
Imagine that…
01:19:05.000 --> 01:19:07.000
Imagine that…
01:19:07.000 --> 01:19:13.000
You were running a query, and you were getting data out of that query, and then, let's say you got…
01:19:07.000 --> 01:19:13.000
You were running a query, and you were getting data out of that query, and then, let's say you got.
01:19:13.000 --> 01:19:18.000
20 rows, right? And now we are doing a fork loop to get something else.
01:19:13.000 --> 01:19:19.000
20 rows, right? And now we are doing a fork loop to get something else.
01:19:18.000 --> 01:19:21.000
from the database out of those rows.
01:19:19.000 --> 01:19:35.000
from the database out of those rows. That's a very inefficient thing to do, and a lot of people do that. So you could do that in one query. I know that you know that stuff very well, Jim, and how to build proper queries to solve that problem.
01:19:21.000 --> 01:19:27.000
Right? That's a very inefficient thing to do. And a lot of people do that. Like, so.
01:19:27.000 --> 01:19:37.000
you could do that in one query. Like, I know that you know that stuff very well, Jim. Like, and how to build proper queries to solve that problem with joins and all that.
01:19:35.000 --> 01:19:38.000
With joins and all that.
01:19:37.000 --> 01:19:41.000
It is complicated for, especially for people…
01:19:38.000 --> 01:19:41.000
It is complicated for especially for people.
01:19:41.000 --> 01:19:54.000
new to databases and all that, it's just so much easier to read the first table, run a for loop, and read… It's worth learning. Yeah, but it's absolutely worth learning, right? So…
01:19:41.000 --> 01:19:54.000
nil to databases and all that. It's just so much easier to read the first table, run a for loop, and read… Yeah, but it's absolutely worth learning, right? So…
01:19:54.000 --> 01:20:07.000
I mean, this is the kind of stuff with AI these days, like, you can just throw Claude against a piece of code that's doing that, it will come back with a proper query, like with joins and whatnot.
01:19:54.000 --> 01:20:09.000
I mean, this is the kind of stuff with AI these days, like, you can just throw Claude against a piece of code that's doing that, it will come back with a proper query, like with joins and whatnot, so you can do that in one go.
01:20:07.000 --> 01:20:09.000
So you can do that in one go.
01:20:09.000 --> 01:20:13.000
And the database has all sorts of optimizations.
01:20:09.000 --> 01:20:14.000
And the database has all sorts of optimizations.
01:20:14.000 --> 01:20:20.000
To make sure that you can fetch that data properly. And, uh, yes, they…
01:20:14.000 --> 01:20:20.000
to make sure that you can fetch that data properly. And, uh, yes, they…
01:20:20.000 --> 01:20:23.000
The structure that will come back from the database is different.
01:20:20.000 --> 01:20:23.000
The structure that will come back from the database is different.
01:20:23.000 --> 01:20:30.000
But I mean, you deal with that, right? And it's just a new way of dealing with the code.
01:20:23.000 --> 01:20:30.000
But I mean, you deal with that, right? And it's just a new way of dealing with with the code.
01:20:30.000 --> 01:20:31.000
Okay.
01:20:30.000 --> 01:20:32.000
Okay. Uh…
01:20:32.000 --> 01:20:43.000
So that's in database, there's just, gosh, so many that we can talk about database that you guys had an episode about database, so I don't want to spend much time on that in terms of optimizations.
01:20:33.000 --> 01:20:43.000
So that's in database. There's, gosh, so many that we can talk about database that, I mean, you guys had an episode about database, so I don't want to spend much time on that in terms of optimizations.
01:20:43.000 --> 01:20:45.000
And, uh…
01:20:43.000 --> 01:20:47.000
And there's one thing.
01:20:45.000 --> 01:20:47.000
There's one thing.
01:20:47.000
--> 01:20:53.000
It's related to database, but not only. It's a problem even more related with memory.
01:20:47.000 --> 01:20:53.000
It's related to database, but not only. It's probably even more related with memory.
01:20:53.000 --> 01:21:03.000
What kind of data structure you use for each thing? I remember in one of the previous episodes you were talking about how do you start time?
01:20:53.000 --> 01:21:03.000
What kind of data structure you use for each thing? I remember in one of the previous episodes, you were talking about, how do you start tying?
01:21:03.000 --> 01:21:13.000
Right? What is the proper way of storing time? Which data type? The databases, they support high-level abstractions, but internally, it's all floating points.
01:21:03.000 --> 01:21:21.000
What is the proper way of storing time? Which data type? The databases, they support high-level abstractions, but internally, it's all floating points. And that's the right thing to do, right? And you're not going to store a string like Sunday, November, whatever, 2000.
01:21:13.000 --> 01:21:25.000
And that's the right thing to do, right? And, uh, you're not gonna start a string like Sunday, November, whatever, 2000… I mean, some people do that, right? Oh, sure. Yeah, it's like…
01:21:21.000 --> 01:21:30.000
I mean, some people do that, right? Sure. Yeah, it's like, that's… you don't do that, like, because that's too expensive. So…
01:21:25.000 --> 01:21:30.000
You don't do that, like, because that's too expensive, so.
01:21:30.000 --> 01:21:31.000
Be careful.
01:21:30.000 --> 01:21:32.000
Be careful.
01:21:32.000 --> 01:21:37.000
Especially when you are creating a data structure in memory or in a database.
01:21:32.000 --> 01:21:37.000
Especially when you are creating a data structure in memory or in a database.
01:21:37.000 --> 01:21:40.000
When you're putting a string there, ask yourself.
01:21:37.000 --> 01:21:40.000
When you're putting a string there, ask yourself.
01:21:40.000 --> 01:21:44.000
Can this be something else other than a string?
01:21:40.000 --> 01:21:44.000
Can this be something else other than a string?
01:21:44.000 --> 01:21:52.000
Right? Because streaming is the most expensive thing that you want to do it for several reasons. It's expensive on storage.
01:21:44.000 --> 01:22:02.000
Because the string is the most expensive thing that you want to do it for several reasons. It's expensive on storage. It is very expensive on parsing, especially UTF strings and things like that. They're very expensive. So you want to avoid strings that…
01:21:52.000 --> 01:22:03.000
it is very expensive on parsing, right? Especially UTF strings and things like that. They're very expensive. So you want to avoid strings at all costs.
01:22:02.000 --> 01:22:07.000
All costs, right? If you can start a number, especially an integer.
01:22:03.000 --> 01:22:07.000
Right? If you can start a number, especially an integer.
01:22:07.000 --> 01:22:09.000
Do with that. Yeah.
01:22:07.000 -->
01:22:10.000
Do with that.
01:22:10.000 --> 01:22:18.000
Yeah. You know, when I think of it like a UUID field, you know, we see them in text and — Oh, yes. People store the text.
01:22:10.000 --> 01:22:23.000
Uh… Mhmm. I see that in the text. Oh, yeah. People saw the text. That Yeah. That kills me. They're very big.
01:22:19.000 --> 01:22:32.000
Yeah, they're very big in text. That kills me. They're very big. Yeah, but start… start at a… in a… in a big int, or an int, or… or, you know, whatever you can. Yes, it really annoys me when I see a UAD in a database, because a UAD is a number.
01:22:24.000 --> 01:22:33.000
Yes. It really annoys me when I see a UAG in a database because a UAG is a member.
01:22:32.000 --> 01:22:46.000
It's like an IP address. People store IP strings in a database. IP address, by definition, is a number. Yeah, an IP address is a string, that's another one, especially in IPv6. Exactly. IPv6 is a number.
01:22:33.000 --> 01:22:43.000
It's like an IP address. People store the IP strings in a database. IP address by definition is a number. Yeah, yeah.
01:22:43.000 --> 01:22:54.000
Exactly. IPv6 is a number. It's a 16-byte number. That's what you need. You store a 16-byte number if you store that whole string.
01:22:46.000 --> 01:22:54.000
Right? It's a 16-byte number. That's what you need, right? You store a 16-byte number. If you store that whole string.
01:22:54.000 --> 01:23:01.000
Like, you are gonna waste the storage of the string, and you are gonna spend a tremendous amount of CPU time translating.
01:22:54.000 --> 01:23:04.000
Like, you are gonna waste the storage of the string, and you're gonna spend a tremendous amount of CPU time translating that string into a 16-byte number.
01:23:01.000 --> 01:23:15.000
that string into a 16 byte number, right? Yeah, because the network stack, it wants a number. A number. Yeah, exactly. When you're going to use that, you're going to use a number, right? So be careful. So related to that.
01:23:04.000 --> 01:23:06.000
Right? Yeah, that works.
01:23:07.000 --> 01:23:15.000
A number. Yeah, exactly. When you're going to use that, you're going to use a number, right? So be careful. So related to that.
01:23:15.000 --> 01:23:23.000
uh, uh, in terms of I.O. and optimizing for I.O, you have to be really careful about file formats in general.
01:23:16.000 --> 01:23:31.000
in terms of I/O and optimizing for I/O, you have to be really careful about file formats in general. Like, I know a lot of people like to use CSVs and JSONs and all that.
01:23:23.000 --> 01:23:38.000
Like, I know a lot of people like to use CSVs and JSONs and all that. XML? XML, Jesus Christ, like XML, yeah. Like the overhead is like 80% or something, right? Yeah.
01:23:31.000 --> 01:23:42.000
XML, Jesus Christ, like, XML, yeah, like, the overhead is, like, 80% or something, right? And, uh, so be mindful of that. Like, when you're creating a file format.
01:23:38.000 --> 01:23:42.000
So, be, be mindful of that. Like, when
you create your file format.
01:23:42.000 --> 01:23:52.000
like, especially if we're dealing with a large amount of data, like, and I know Wolf works with, like, geographical data and all that, those things can get really big.
01:23:42.000 --> 01:24:00.000
Especially if we're dealing with a large amount of data. I know Wolf works with geographical data and all that. Those things can get really big. You want to be really mindful. I'm a big fan of file formats like Apache Parquet.
01:23:52.000 --> 01:24:09.000
Like so you want you want to be really mindful. Like so I'm a big fan of file formats like Apache Parquet. And there's like many interesting formats for that kind of data. Like, but it's very common that people would do like, oh, let's just do a CSV.
01:23:53.000 --> 01:23:54.000
Oh yeah.
01:24:00.000 --> 01:24:13.000
And there's, like, many interesting formats for that kind of data, like, but it's very common that people would do, like, oh, let's just do a CSV, like, or a JSON, or something. Like, again.
01:24:09.000 --> 01:24:16.000
Like, or a JSON or something. Like, again, it's costing, storage, space.
01:24:13.000 --> 01:24:16.000
It's costing storage space.
01:24:16.000 --> 01:24:24.000
And it's costing an insane amount of CPU to serialize and deserialize that, because every time you're writing a JSON.
01:24:16.000 --> 01:24:24.000
And it's costing an insane amount of CPU to serialize and deserialize that, because every time you're writing a JSON.
01:24:24.000 --> 01:24:39.000
like with anything text, you are serializing that. And every time someone else is reading that, they are, again, deserializing that. And that's very, very expensive. Like in memory, it's a lot of memory churn, because you are dealing with an enormous amount of bytes.
01:24:24.000 --> 01:24:39.000
Like, or anything in text, you are serializing that. And every time someone else is reading that, they are, again, deserializing that. And that's very, very expensive. Like, in memory, it's a lot of memory churn, because you are dealing with an enormous amount of bytes.
01:24:39.000 --> 01:24:46.000
And it's a lot of amount of CPU because you have to essentially understand the format and all that.
01:24:39.000 --> 01:24:47.000
And it's a lot of amount of CPU, because you have to essentially understand the format and all that.
01:24:46.000 --> 01:24:57.000
Compression, that's another very interesting topic. Like, I think there is this huge misconception that compressing is always good, right?
01:24:47.000 --> 01:25:02.000
Compression, that's another very interesting topic. I think there is this huge misconception that compressing is always good. It may be. Compression is a trade-off. What's more important for you? Storage?
01:24:57.000 --> 01:25:03.000
It may be. Compression is a trade-off. Like, what's more important for you, storage or CPU?
01:25:02.000 --> 01:25:03.000
or CPU.
01:25:03.000 --> 01:25:14.000
Like, if you have a lot of data that is compressible, and storage, or transmission, like we're gonna talk about networking later, is worth it. It's expensive.
01:25:03.000 --> 01:25:16.000
Like, if you have a lot of data that is compressible, and storage or transmission, like we're going to talk about networking later, is worth it. It's expensive. You want to spend that CPU.
01:25:14.000 --> 01:25:16.000
You wanna spend that CPU.
01:25:16.000 --> 01:25:23.000
to shrink, like to reduce the number of bytes that you have to either store or transmit.
01:25:17.000 --> 01:25:24.000
to shrink, to reduce the number of bytes that you have to either store or transmit.
01:25:23.000 --> 01:25:30.000
And that trade-off is worth it. But it's not always worth it. Sometimes, like, CPU is very expensive.
01:25:24.000 --> 01:25:35.000
And that trade-off is worth it. But it's not always worth it. Sometimes, like, CPU is very expensive. Like, let's say you need to do compression on the hot path, your CPU is already busy.
01:25:30.000 --> 01:25:35.000
Like, let's say you need to do compression on the hot path, your CPU is already busy, right?
01:25:35.000 --> 01:25:36.000
You don't want to do…
01:25:35.000 --> 01:25:36.000
You don't want to do.
01:25:36.000 --> 01:25:39.000
Spend more time on the CPU.
01:25:36.000 --> 01:25:39.000
spend more time on the CPU.
01:25:39.000 --> 01:25:48.000
like, to solve a problem that you don't have. Keep in mind, what is the problem they're trying to solve? Storage may not be the problem they're trying to solve.
01:25:39.000 --> 01:25:48.000
like, to solve a problem that you don't have. Keep in mind, what is the problem they're trying to solve? Storage may not be the problem they're trying to solve.
01:25:49.000 --> 01:25:56.000
Uh, there is a life cycle discussion that's interesting. Don't start data longer than you need it.
01:25:50.000 --> 01:25:58.000
Uh, there is a life cycle discussion that's interesting. Don't store data longer than you need it, right? Sometimes you…
01:25:56.000 --> 01:25:58.000
Right, sometimes you.
01:25:58.000 --> 01:26:05.000
You have logs, for example, like, and you were storing logs in a database. Do you need that five years later?
01:25:58.000 --> 01:26:05.000
You have logs, for example, and you're restoring logs in a database. Do you need that five years later?
01:26:05.000 --> 01:26:21.000
Maybe yes, maybe no. That's a business decision. It's not a technical decision, but it's just something to be mindful of. Like going back to cloud costs, like let's say that you were using a database on AWS like DynamoDB or RDS or something like that. Those things are really expensive.
01:26:05.000 --> 01:26:21.000
Maybe yes, maybe no. That's a business decision. It's not a technical decision, but it's just something to be mindful of. Going back to cloud costs, let's say that you were using a database on AWS like DynamoDB or RDS or something like that, those things are really expensive.
01:26:21.000 --> 01:26:37.000
Right? You don't want to be starting things for longer
than you need, right? So be careful about retention paralysis, tiering, like if you use Amazon S3, for example, right? You can have multiple tiers, like all the data that you want on your hot path.
01:26:21.000 --> 01:26:37.000
You don't want to be storing things for longer than you need. So be careful about retention paralysis, tiering. If you use Amazon S3, for example, you can have multiple tiers, like all the data that you want on your hot path.
01:26:37.000 --> 01:26:47.000
that's more expensive, then you pay for that. And old data that's very unlikely that people will access, you can move to other tiers that are much, much cheaper.
01:26:37.000 --> 01:26:47.000
that's more expensive, then you pay for that. And all the data that's very unlikely that people will access, you can move to other tiers that are much, much cheaper.
01:26:47.000 --> 01:26:48.000
And, uh…
01:26:47.000 --> 01:26:49.000
And, uh…
01:26:48.000 --> 01:26:52.000
So, when you set your retention policies, you can do that.
01:26:49.000 --> 01:26:52.000
So when you set your retention policies, you can do that.
01:26:53.000 --> 01:26:58.000
Uh… Another thing is that with flashes specifically.
01:26:54.000 --> 01:26:58.000
Another thing is that with flashes specifically.
01:26:58.000 --> 01:27:00.000
Uh, when you have an SSD.
01:26:58.000 --> 01:27:00.000
Uh, when you have an SSD.
01:27:00.000 --> 01:27:02.000
Which is very common these days.
01:27:00.000 --> 01:27:07.000
which is very common these days, they are not as durable as you think they are.
01:27:02.000 --> 01:27:07.000
They… they are not as durable as you think they are.
01:27:07.000 --> 01:27:14.000
Like they have, they suffer of wear a lot. So be very careful how much you are writing to them.
01:27:07.000 --> 01:27:15.000
Like they have, they suffer of wear a lot. So be very careful how much you are writing to them.
01:27:14.000 --> 01:27:20.000
Right? So if you have an application that uses the disk to do a lot of I.O.
01:27:15.000 --> 01:27:20.000
Right? So if you have an application that uses the disk to do a lot of I.O.
01:27:20.000 --> 01:27:26.000
That's unnecessary. It may be beneficial that you do that in memory instead.
01:27:20.000 --> 01:27:35.000
that's unnecessary, it may be beneficial that you do that in memory instead, like, so you can save the durability of your SSDs. So be careful with that. Like, one classic example is that if you are building an NVR.
01:27:26.000 --> 01:27:38.000
Like, so you can save the durability of your SSDs. So be careful with that. Like, one classic example is that if you are building an NVR, like a video recorder.
01:27:35.000 --> 01:27:38.000
Like a… like a video recorder?
01:27:38.000 --> 01:27:50.000
And for cameras, most vendors, they will suggest that you have a spinning disk instead. Because first, NVRs don't need to be really fast, because the camera is a streaming device.
01:27:38.000 --> 01:27:50.000
And for cameras, most vendors, they will suggest that you have a
spinning disk instead. Because first, NVRs don't need to be really fast because the camera is a streaming device.
01:27:50.000 --> 01:28:01.000
And, uh, but you need retention, right? And that you are writing sequential writes forever, like 24-7, 365. So a flash is a pretty bad device for that.
01:27:50.000 --> 01:28:01.000
And, uh, but you need retention, right? And you are writing sequential writes forever, like 24-7, 365. So a flash is a pretty bad device for that.
01:28:01.000 --> 01:28:04.000
They're faster, but they're not as durable.
01:28:01.000 --> 01:28:06.000
They're faster, but they're not as durable. Uh…
01:28:06.000 --> 01:28:22.000
Logging, that's a very classic problem in production, like people enable debug logging and they log so, so much stuff that they don't need it. That's very expensive, right? Every time that you are logging, you are causing system calls, you are causing context switches, like you are spending.
01:28:06.000 --> 01:28:23.000
Logging, that's a very classic problem in production. People enable debug logging, and they log so, so much stuff that they don't need it. That's very expensive. Every time that you are logging, you are causing system calls, you are causing context switches, you are spending so much time.
01:28:22.000 --> 01:28:32.000
so much time waiting, like, for that log to be confirmed and all that. Log what you need and manage those log levels in production.
01:28:23.000 --> 01:28:36.000
time waiting, like, for that log to be confirmed and all that. Log what you need, and manage those log levels in production. Like, as a system admin myself, the last thing that I want.
01:28:32.000 --> 01:28:39.000
Like, as a system admit myself, the last thing that I want is to be drowning in logs.
01:28:36.000 --> 01:28:40.000
is to be drowning in logs. That…
01:28:39.000 --> 01:28:45.000
Don't matter, right? So when you are writing code, don't don't write.
01:28:40.000 --> 01:28:45.000
Don't matter, right? So when you are writing code, don't don't write.
01:28:45.000 --> 01:28:57.000
to standard output or standard error directly. Like, that's lazy, right? Like, use a proper logging framework. Like, Python has logging, Rust has tracing, and uh…
01:28:45.000 --> 01:28:58.000
to standard output or standard error directly. Like, that's lazy, right? Like, use a proper logging framework. Like, Python has logging, Rust has tracing, and uh…
01:28:56.000 --> 01:29:10.000
But you don't use logging. If you are using Python, you should absolutely use LogGuru. It's significantly better, um, and when you are a library, yeah, um.
01:29:04.000 --> 01:29:06.000
Oh, okay.
01:29:04.000 --> 01:29:06.000
Oh, okay.
01:29:06.000 --> 01:29:09.000
Okay. I learned something.
01:29:06.000 --> 01:29:09.000
Okay, I learned. I learned something.
01:29:10.000 --> 01:29:16.000
We can talk about it later, but yeah. Logging, yes, for sure.
01:29:13.000 --> 01:29:15.000
That's very good.
01:29:13.000 --> 01:29:15.000
That's very good.
01:29:16.000 --> 01:29:34.000
Mm-hmm. And, uh, yes, so this is important, because then it gives the operator more control over where the logs are going. You can send to a syslog server, you can send to the disk, right? If you write everything directly to the standard error or standard output.
01:29:17.000 --> 01:29:18.000
And.
01:29:18.000 --> 01:29:30.000
Yes, so this is important because then it gives the operator more control over where the logs are going. You can send to a syslog server, you can send to the disk.
01:29:30.000 --> 01:29:37.000
If you write everything directly to the standard error or standard output, you essentially removed that control from the operator.
01:29:34.000 --> 01:29:49.000
you essentially removed that control from the operator, right? So be mindful about that. Like, if it's a small script, yeah, sure, just print your standard error, standard output, nobody cares. But in an actual application, like, please don't do that. Like, use something that's more…
01:29:37.000 --> 01:29:49.000
Right? So be mindful about that. Like, if it's a small script, yeah, sure, just print your standard error, standard output, nobody cares. But in an actual application, like, please don't do that. Like, use something that's more, uh…
01:29:49.000 --> 01:30:01.000
sophisticated. So IO is complicated, right? It's expensive, it's slow, right? So you really need to be mindful, right, about IO in general.
01:29:49.000 --> 01:29:51.000
sophisticated.
01:29:51.000 --> 01:29:59.000
So IO is complicated, right? It's expensive, it's slow, right? So you really need to be mindful.
01:29:59.000 --> 01:30:01.000
Right, about a young gender.
01:30:03.000 --> 01:30:04.000
So…
01:30:03.000 --> 01:30:07.000
So networking, that's our last topic.
01:30:04.000 --> 01:30:07.000
Networking, that's our last topic.
01:30:07.000 --> 01:30:09.000
Uh… 20 minutes.
01:30:07.000 --> 01:30:09.000
Uh…
01:30:10.000 --> 01:30:18.000
Before I talk about networking, there is one concept that's really important to understand, is the difference between latency and bandwidth.
01:30:10.000 --> 01:30:25.000
Before I talk about networking, there is one concept that's really important to understand is the difference between latency and bandwidth, right? So usually when I talk about network, we talk about bandwidth. Like, oh, I have my internet is, I don't know, a gigabit, whatever, right?
01:30:18.000 --> 01:30:21.000
Right. So usually when you talk about network, we talk about.
01:30:21.000 --> 01:30:34.000
bandwidth. Like, oh, I have my internet is, I don't know, a gigabit, whatever, right? And, uh, when we build a circuit, like, the circuit is, like, 10 gigabits connecting my two data centers, whatever, right? So, that's the bandwidth.
01:30:25.000 --> 01:30:34.000
And when we build a circuit, like, the circuit is, like, 10 gigabits connecting my two data centers, whatever, right? So that's the bandwidth of the circuit.
01:30:34.000 --> 01:30:39.000
A lot of times, bandwidth
doesn't matter, right? What really matters is latency.
01:30:34.000 --> 01:30:49.000
A lot of times, bandwidth doesn't matter, right? What really matters is latency, right? Is how fast I can move data, fast in time, right? How long it takes for me to move this packet from A to B.
01:30:39.000 --> 01:30:42.000
right, is how fast they can move.
01:30:42.000 --> 01:30:48.000
data fast in time, right? How long it takes for me to move this packet from.
01:30:48.000 --> 01:30:53.000
from A to B. And, that's usually what we…
01:30:49.000 --> 01:30:54.000
And, uh… That's usually what we care.
01:30:53.000 --> 01:30:54.000
Care?
01:30:54.000 --> 01:31:00.000
as a user, right? As you perceive in terms of slowness. Like, I'm using an app.
01:30:54.000 --> 01:31:08.000
as a user, right? As you perceive in terms of the slowness. Like, I'm using an app, it's taking forever to load the page, for example. Like, it could be a bandwidth problem, most likely it's a latency problem.
01:31:00.000 --> 01:31:08.000
It's taking forever to load the page, for example, right? It could be a bandwidth problem, most likely it's a latency problem.
01:31:08.000 --> 01:31:10.000
Right, so there are.
01:31:08.000 --> 01:31:10.000
Right? So there are…
01:31:10.000 --> 01:31:14.000
Many things that as a software developer that you can do.
01:31:10.000 --> 01:31:14.000
Many things that as a software developer that you can do.
01:31:14.000 --> 01:31:26.000
to reduce or to minimize the latency problem. Like, the way you develop the APIs, like, like, really avoid round trips, because that's when latency bites you.
01:31:14.000 --> 01:31:29.000
to reduce or to minimize the latency problem, like, uh, the way you develop the APIs, like, like, really avoid round trips, because that's when latency bites you. Like, if you are doing, like, a lot of, like, small calls.
01:31:26.000 --> 01:31:31.000
Like, if you're doing, like, a lot of, like, small calls, right, where you could be using.
01:31:29.000 --> 01:31:37.000
Right? Where you could be using batching, for example, or pipelining, or reuse a connection, right? So…
01:31:31.000 --> 01:31:40.000
batching, for example, or pipelining, or reuse a connection, right? So… Uh, Jim and I were just talking about, uh.
01:31:37.000 --> 01:31:44.000
Uh, Jim and I were just talking about, uh, WebSockets, for example, right? Which is great, but it…
01:31:40.000 --> 01:31:51.000
WebSockets, for example, right? Which is great, but it… It's dangerous in a way that it's so nice that you may end up developing a very chatty API.
01:31:44.000 --> 01:31:51.000
It's dangerous in a way that it's so nice that you may end up developing a very chatty API.
01:31:51.000 --> 01:32:05.000
Just because you can, right? But every time you send a message back and forth, you are paying that latency, right? And, especially these days, everybody using 5G networks and all that, like, that's very noticeable, right?
01:31:51.000 --> 01:32:06.000
Just because you can, right? But every time you send a message back and forth, you are paying that latency, right? And especially these days, everybody using 5G networks and all that, like, that's very noticeable, right? So sometimes, like.
01:32:05.000 --> 01:32:17.000
Right? So sometimes, like, you could take advantage of batching, like, instead of doing one request at a time, I could batch my request and send, let's say, 50 at a time, like, instead of one at a time.
01:32:06.000 --> 01:32:22.000
You could take advantage of batching. Instead of doing one request at a time, I could batch my request and send, let's say, 50 at a time, instead of one at a time. Another interesting thing that a lot of these protocols support now is pipelining.
01:32:17.000 --> 01:32:22.000
Another interesting thing that a lot of these protocols support now is pipelining.
01:32:22.000 --> 01:32:26.000
Where they can make several requests at once.
01:32:22.000 --> 01:32:26.000
Where I can make several requests at once.
01:32:26.000 --> 01:32:32.000
And then I can wait for the responses and those responses could come out of order.
01:32:26.000 --> 01:32:42.000
And then I can wait for the responses. And those responses could come out of order, right? They don't need to come at the same time. And HTTP2 supports that. And web browsers take advantage of that. Like, when you're loading a page.
01:32:32.000 --> 01:32:45.000
Right? They don't need to come at the same time. And HTTP2 supports that, and uh… and web browsers take advantage of that. Like, when you're loading a page, like, the browser fires all requests at once.
01:32:42.000 --> 01:32:48.000
Like, the browser fires all requests at once, right? And then they show up when they show up.
01:32:45.000 --> 01:32:55.000
Right? And then they show up when they show up. Like, some will be faster than others, and etc. So browsers are huge, huge users of, uh, of, uh.
01:32:48.000 --> 01:32:58.000
Like, some will live faster than others, and etc. So browsers are huge, huge users of, uh, of what… Be careful about…
01:32:56.000 --> 01:33:01.000
Be careful about… payload size. It, for example.
01:32:58.000 --> 01:33:02.000
payload size. It, for example.
01:33:01.000 --> 01:33:16.000
You are developing a website, and you put your logo there, and your logo is like a one megabyte JPEG, like completely unnecessary. Like, a lot of people don't pay attention to that. Like, or if you are building a mobile app, the mobile app is giant.
01:33:02.000 --> 01:33:17.000
You are developing a website, and you put your logo there, and your logo is like a 1MB JPEG, like, completely unnecessary. Like, a lot of people don't pay attention to that. Like, or if you are building a mobile app, the mobile app is giant.
01:33:16.000 --> 01:33:25.000
Right? And so be mindful of that, like, so every time you're adding something to your payload, make sure that you are not.
01:33:17.000 --> 01:33:25.000
Right? And so be mindful of that, like, so every time you're adding something to your
payload, make sure that you are not.
01:33:25.000 --> 01:33:27.000
Spending more than what you need.
01:33:25.000 --> 01:33:27.000
spending more than what you need.
01:33:27.000 --> 01:33:29.000
I take advantage of cash.
01:33:27.000 --> 01:33:35.000
Like, take advantage of cash. Like, if you have a CDN, for example, right? Like, take as much advantage of…
01:33:29.000 --> 01:33:39.000
Like, if you have a CDN, for example, right? Like, take as much advantage of… Prosperous that like with images and any content that's not dynamic.
01:33:35.000 --> 01:33:41.000
I suppose that like with images and any content that's not dynamic like.
01:33:39.000 --> 01:33:40.000
Like.
01:33:41.000 --> 01:33:51.000
Uh, protocols are important, like, so we talk about WebSockets, there's other things like gRPC and etc, where, like, be mindful when you work.
01:33:41.000 --> 01:33:51.000
Uh, protocols are important, like, so we talk about WebSockets, there's other things like gRPC and etc, where, like, be mindful when you work.
01:33:51.000 --> 01:33:59.000
You have two applications talk to each other, right? What protocols they are using and gRPC is a big one these days.
01:33:51.000 --> 01:33:59.000
You have two applications talk to each other, right? What protocols they are using, and gRPC is a big one these days.
01:33:59.000 --> 01:34:05.000
And, uh, going back to costs in the cloud, it's expensive. Every byte that you move out of.
01:33:59.000 --> 01:34:12.000
And going back to costs in the cloud, it's expensive. Every bite that you move out of cloud, you are paying for egress, and they charge you, right? And that can become really expensive.
01:34:05.000 --> 01:34:12.000
Cloud, you are paying for egress and they charge you, right? And that can become really expensive.
01:34:12.000 --> 01:34:20.000
We talk about mobile networks like they're very unreliable. Like 5G is only great if you are next to a tower as you start walking.
01:34:12.000 --> 01:34:20.000
We talk about mobile networks, like, they're very unreliable, like, 5G is only great if you're next to a tower as you start walking.
01:34:20.000 --> 01:34:30.000
like, it's… you start losing packets and all that, like, and uh… so keep that in mind. Like, if you can develop an application that's resilient to that.
01:34:20.000 --> 01:34:30.000
Like, it's… you start losing packets and all that, like, and uh… so keep that in mind. Like, if you can develop an application that's resilient to that.
01:34:30.000 --> 01:34:31.000
Like, uh…
01:34:30.000 --> 01:34:32.000
Like.
01:34:31.000 --> 01:34:35.000
And uh… and to close out on that work.
01:34:32.000 --> 01:34:42.000
And, uh, and to close out a network, like, expect the network to be unreliable, because they will be, right? Unless you have a fiber between.
01:34:35.000 --> 01:34:55.000
Like, expect the network to be unreliable, because they will be, right? Unless you have a fiber between… A and B, right? If you have anything that's wireless, it will be unreliable. So be very careful with, like, things like retry storms and etc, like, so whenever you write a code.
01:34:42.000 --> 01:34:57.000
A and B, right? If you have anything that's wireless, it will be unreliable. So be very careful with, like, things like retry storms and etc. Like, so whenever you write a code that retry.
01:34:55.000 --> 01:34:57.000
That retry.
01:34:57.000 --> 01:35:11.000
a request, just be mindful that that retry may storm the server, right? So do some kind of, like, an exponential backoff, so you are waiting longer and longer before retrying again.
01:34:57.000 --> 01:34:59.000
Uh, uh, uh, a request?
01:34:59.000 --> 01:35:10.000
Just be mindful that that retry may storm the server, right? So do some kind of like a exponential back off so you are waiting longer and longer before retrying again.
01:35:10.000 --> 01:35:19.000
And so you don't destroy your own infrastructure like the DDoS yourself. Like you definitely don't want to do that.
01:35:11.000 --> 01:35:19.000
And, so you you don't destroy your own infrastructure, like, like, did you did us yourself? Like, you definitely don't wanna do that.
01:35:22.000 --> 01:35:28.000
Yeah, those are the topics that I want to talk about, like CPU, memory, I/O, and networking, of course.
01:35:22.000 --> 01:35:28.000
Yeah, those are the topics that I want to talk about, like CPU, memory, I/O, and networking. Of course.
01:35:28.000 --> 01:35:35.000
efficiency, especially in code or infrastructure, we could talk forever about this. But I think that's, uh…
01:35:28.000 --> 01:35:36.000
efficiency, especially in code or infrastructure, we could talk forever about this. But I think that's, uh…
01:35:35.000 --> 01:35:37.000
Those are…
01:35:36.000 --> 01:35:46.000
Those are nice few topics that I think people should keep in mind when they're developing software, especially software that's going to be used toward other people that you don't control.
01:35:37.000 --> 01:35:46.000
nice few topics that I think people should keep in mind when they're developing software, especially software that's gonna be used for other people that you don't control.
01:35:46.000 --> 01:35:48.000
Yeah!
01:35:48.000 --> 01:35:51.000
That's a lot of stuff.
01:35:48.000 --> 01:35:50.000
That's a lot of stuff.
01:35:51.000 --> 01:35:55.000
Oh, oh, I, I appreciate you, uh, uh.
01:35:51.000 --> 01:35:55.000
Oh, I appreciate you.
01:35:55.000 --> 01:36:03.000
doing this, taking the time to sit with us and talk. I know you put some preparation into this, and I can't tell you how much I appreciate it.
01:35:56.000 --> 01:35:58.000
Doing this, taking the…
01:36:03.000 --> 01:36:16.000
Um, Marlon has a couple of code examples that, uh, he, he will give me, and I will, uh, you know, Runtime Arguments has a, a GitHub account, and I will put those.
01:36:16.000 --> 01:36:19.000
Um, examples up on our GitHub, uh.
01:36:19.000 --> 01:36:24.000
account and provide the links in the show notes.
01:36:24.000 -->
01:36:31.000
Because they're very simple examples that really highlight some performance issues.
01:36:31.000 --> 01:36:40.000
And I think anybody who's interested in this, if they took a look at that, they'd learn from it. So the examples would be like one.
01:36:37.000 --> 01:36:44.000
Yeah. So the examples would be like one way of not doing things in a better way.
01:36:40.000 --> 01:36:55.000
way of not doing things in a better way. Very simple. Like each one is like five lines of code. It's just to bring the topic home and show that in code. Like how sometimes a few lines make the whole difference.
01:36:44.000 --> 01:36:56.000
Like, very simple. Like, each one is, like, 5 lines of code. It's just to bring the topic home, and show that in code. Like, how sometimes a few lines make the whole difference.
01:36:56.000 --> 01:37:01.000
Yeah, so we'll put that up there on GitHub and point you all to where it is.
01:36:57.000 --> 01:36:59.000
So we'll put them up there and get off it.
01:37:00.000 --> 01:37:01.000
It's.
01:37:02.000 --> 01:37:04.000
Oh.
01:37:02.000 --> 01:37:18.000
This was fantastic. This was a topic that 100% interested me in every way. I love it when.
01:37:18.000 --> 01:37:19.000
First of all.
01:37:19.000 --> 01:37:35.000
Regardless of the domain, when you see a singer who's a great singer do their thing, it's magical. Even if you don't like the music, seeing someone who's good at it.
01:37:35.000 --> 01:37:47.000
is great. Uh, when the plumber comes, and you've got the good plumber, and the plumber does the thing, it's enchanting to watch, because they know what they're doing.
01:37:47.000 --> 01:38:03.000
Um, and this time, it was the best of all possible worlds, because not only is it a practitioner, skilled in the art, and knowledgeable in all the details.
01:38:03.000 --> 01:38:14.000
But, it's not outside my domain. For all of you who have ever watched, um… Blade Runner.
01:38:14.000 --> 01:38:30.000
There's a scene in Blade Runner right after the female replicant who only just found out she's a replicant saves his life, saves Decker's life from.
01:38:30.000 --> 01:38:32.000
Neon.
01:38:32.000 --> 01:38:33.000
And.
01:38:33.000 --> 01:38:37.000
He has to give her a drink, and he says.
01:38:37.000 --> 01:38:38.000
Shakes.
01:38:38.000 --> 01:38:43.000
You get him in this business and she says.
01:38:43.000 --> 01:38:46.000
I'm not in the business.
01:38:46.000 --> 01:38:49.000
I am the business.
01:38:50.000 --> 01:38:57.000
And this time we got to talk to somebody.
01:38:57.000 --> 01:38:59.000
About.
01:38:59.000 --> 01:39:14.000
the very thing I care most about. Someone who knows it, who does it, who is as in it as I am, and it was an absolute pleasure to.
01:39:06.000 --> 01:39:08.000
This is horrible.
01:39:14.000 --> 01:39:31.000
have you talk about everything that you do, Marlon, your, uh, view on what's important and what people should know. It was enchanting, just because you're an expert, and even more so to
me.
01:39:31.000 --> 01:39:41.000
Because I'm an expert. This made my day. Probably my week. Thank you so much.
01:39:39.000 --> 01:39:55.000
I'm glad to hear. Yeah, thank you guys for inviting me. It was a pleasure. And I really cared about these things. I cared about helping other people care and learn about these things because it matters, right? We all want to be more efficient.
01:39:39.000 --> 01:39:56.000
I'm glad to be here. Yeah, thank you guys for inviting. It was a pleasure. And I really cared about these things. I cared about helping other people care and learn about these things because it matters, right? We all want to be more efficient and not be…
01:39:55.000 --> 01:39:56.000
to not be…
01:39:56.000 --> 01:40:01.000
Wasting our money and other people's money into…
01:39:56.000 --> 01:40:04.000
Wasting our money and other people's money into… CPU cycles and etc. Unnecessarily.
01:40:01.000 --> 01:40:04.000
CPU cycles and et cetera, unnecessarily.
01:40:03.000 --> 01:40:19.000
Yeah, as all three of us, as the builders of things that will go into other people's hands and they will use for far longer than anyone thought they would.
01:40:20.000 --> 01:40:22.000
It's not just.
01:40:22.000 --> 01:40:29.000
good to give them something that's going to do the job better than they might have had?
01:40:29.000 --> 01:40:33.000
It's our obligation.
01:40:32.000 --> 01:40:33.000
I agree.
01:40:32.000 --> 01:40:35.000
I agree. It's a… yeah.
01:40:33.000 --> 01:40:36.000
To give them something that, yeah.
01:40:36.000 --> 01:40:38.000
It's a responsible thing to do.
01:40:36.000 --> 01:40:38.000
It's a responsible thing to do.
01:40:36.000 --> 01:40:44.000
So… Yeah, um… Is it time for me to wrap it all up?
01:40:44.000 --> 01:40:47.000
Yeah, I think it is.
01:40:47.000 --> 01:40:48.000
All right.
01:40:47.000 --> 01:40:49.000
Go ahead.
01:40:48.000 --> 01:41:12.000
First of all, to anyone who made it this far, fantastic! Either you're already here where we are or you're on your way and we couldn't be happier that we were able to share with you stuff that matters to us and thank you for sharing your time.
01:41:13.000 --> 01:41:23.000
If you want to give us feedback, you can send email to feedback at runtimearguments dot fm.
01:41:23.000 --> 01:41:32.000
You're looking at the show right now, listening to it, so however you got it, it came with show notes and a transcript.
01:41:32.000 --> 01:41:48.000
If you want to communicate with Marlon, send feedback to the show and say that you want to tell him something. We'll make sure it gets to him. I don't want to just hand out his contact information. That wouldn't be fair.
01:41:48.000 --> 01:41:56.000
We have a website. It is, at the moment, HTTP, no S, colon.
01:41:56.000 --> 01:42:07.000
slash slash runtimearguments.fm. Marlin says, we have a choice, we can maybe make it better. We could get the S.
01:42:08.000 --> 01:42:12.000
We care about your feedback.
01:42:08.000 --> 01:42:10.000
Yeah, let's do them.
01:42:09.000 --> 01:42:11.000
Yeah, let's… let's do that.
01:42:12.000 --> 01:42:37.000
Tell us what we're doing right, tell us what we're doing wrong, tell us what you'd like to hear about, um… And please tell us that you also do not want any video. Or, you know, the opposite. That could be true. I think that's it. So goodbye from me. Jim? Marlon?
01:42:31.000 --> 01:42:33.000
Yeah.
01:42:37.000 --> 01:42:43.000
Uh, goodbye, and thank you, Marlon. Yeah, thank you so much for having me. Goodbye, everyone.
01:42:40.000 --> 01:42:43.000
Yeah. Thank you so much for having me. Goodbye, everyone.
01:42:46.000 --> 01:42:48.000
All right.
01:42:48.000 --> 01:42:50.000
Bye, everybody.