Podchaser Logo
Home
171: Compilers and Interpreters

171: Compilers and Interpreters

Released Monday, 12th February 2024
Good episode? Give it some love!
171: Compilers and Interpreters

171: Compilers and Interpreters

171: Compilers and Interpreters

171: Compilers and Interpreters

Monday, 12th February 2024
Good episode? Give it some love!
Rate Episode

Episode Transcript

Transcripts are displayed as originally observed. Some content, including advertisements may have changed.

Use Ctrl + F to search

0:02

Programing Throwdown,

0:05

Episode 171,

0:09

Compilers and

0:11

Interpreters. Take

0:22

it away, Jason. Hey everybody!

0:27

This is super exciting. We

0:29

got this request from a

0:31

listener. Maybe later on

0:33

the show I'll find out, remind myself

0:35

who it was. But they said, how

0:37

about you folks do compilers and interpreters?

0:40

I can't believe we haven't done

0:42

this episode. It seems so pivotal

0:44

to everything we do in

0:48

software engineering. But

0:51

yeah, here we are to lead

0:53

the way. I have to

0:56

confess, I don't know as much about

0:58

compilers and interpreters as Patrick. Patrick's really

1:00

going to carry the water here, but

1:03

I will add color commentary as appropriate.

1:08

Before we get into that, I wanted to talk about

1:11

monitor setups for a little bit. I

1:15

was working next to somebody who

1:17

had three monitors, side by

1:20

side by side. They

1:22

had three different things going on. They

1:24

had one was for coding, the other

1:26

one was for email. I

1:29

thought this was really compelling. I thought, oh,

1:31

this is a great idea. I

1:34

just can't get myself to do it. Basically

1:36

I just have to have just one thing in

1:39

front of me and just

1:42

keep all tabbing to go to different

1:44

things. I haven't

1:46

figured out how to drag from one

1:48

desk screen to the other and do all of

1:51

that. What is

1:53

your setup? Do you have

1:55

an array of monitors? What

1:57

do you do? Yeah, eight.

2:00

No, I don't. Seriously? I

2:03

do all my programming in VR, so I

2:05

just have as many as I want. I actually do look

2:07

for it. I think that'll be cool one day, one day. That

2:10

day is not today. I just

2:12

have one big one, but I also have iPad

2:15

off to the side that I use

2:17

for my conferencing, for video conferencing. That

2:20

works well for me, so I guess it's

2:22

technically two, but I'm on big one for

2:24

sort of similar reasons to what you're saying.

2:27

Normally if you have two monitors, you just get them

2:29

extra wide or on top of each other, which is

2:31

too much, versus one big monitor, I feel. You don't

2:34

end up with an awkward split in the middle or

2:36

have to shift one far to the side. Right.

2:39

I will say for people who do simulation race

2:41

games or flight games, having three for a gaming

2:43

setup would be really cool, because you're

2:46

one thing over three, and the people who

2:48

do, of course, the stock trading, where

2:50

they're actually just mostly focused on

2:53

one task. All

2:55

of it is related. There's just

2:57

lots of dials and metrics. It's akin to,

2:59

I think, a cockpit and an airplane, where

3:02

there's many, many indicators. Some are lower

3:04

priority, but they're kind of very related

3:07

to a singular task. To

3:09

me, it seems a little bit different. When

3:11

you're doing your programming, email is...

3:15

Maybe that's not fair. I don't know. I've never

3:17

been those other things, but it feels like a

3:19

different task. Slack or email, they feel different to

3:21

the task of coding. I'm

3:24

with you. I don't feel compelled to have them up

3:26

on the side. Yeah. I

3:30

used to have my laptop. My

3:33

laptop right now is just mirroring

3:35

the screen of

3:37

the main display. I

3:39

used to have it, kind of like what you

3:41

were saying, where it was sort of secondary screen, but

3:45

I found myself not paying attention in

3:47

meetings, even when I should be. I

3:51

kind of couldn't do that. Isn't

3:54

this like a trope that people can't

3:56

actually multitask? sequentially

4:00

singular task. Yeah. Yeah,

4:03

I mean I just But

4:06

yeah, I mean I do envy the people who can have

4:09

like three different screens on and not be distracted

4:11

I will say

4:13

I do find I it's

4:16

not all bad I think if you

4:18

occasionally need like a paper or document or

4:20

you're implementing an algorithm and you want to

4:23

consult something or The

4:25

few times I've had the kind of I'm

4:27

generating some kind of output or whatever. That's visual

4:31

It's very cool to have a extra

4:33

real estate where when I update something and click,

4:35

you know Test I can sort

4:37

of still see the code but

4:39

see the results and you know up inside

4:41

it You know screen real estate can be

4:43

very very useful So I'll never sort of

4:45

say something bad against someone who who wants

4:47

to have more screens But the variety is

4:49

yeah, it is very interesting Yeah,

4:52

I wonder You

4:55

know now that I'm working from home, it's less

4:57

of an issue But when I was going into

4:59

the office, I was running into problems where you

5:01

my home Monitor

5:04

and my office monitor aren't the same and

5:07

so, you know It wouldn't quite extend the desktop

5:09

the right way and things would get all messed

5:11

up That's the

5:14

thing I've been picky about is I have

5:16

my monitor pretty high. I'm I'm fairly tall.

5:18

So I Want you

5:20

know my monitor nice and high so I either put

5:22

little plastic risers or put it on a monitor arm

5:24

and lift it up So I have it higher than

5:26

I think what I see a lot

5:28

of other people do just because it feels unnatural to me

5:30

All right. We have to have a we have to have

5:32

a bake-off here. My monitor is on

5:35

a I'm trying to

5:38

eyeball it maybe like an eight inch riser

5:41

What about you? Oh, I'm sorry. Look on

5:43

the bottom of my screen. I'm like at a like

5:45

a foot Like oh wow.

5:47

Okay, that's even bigger. I might be Yeah,

5:50

a little bit more than eight inches Yeah, that

5:52

is pretty tall so like the when you look

5:54

at your monitor at eye level are you looking

5:56

at the center of it? I

5:59

wish it's not I'm not quite that high, the

6:01

monitor, I'm gonna go quite that high. So it's, yeah,

6:03

I'm looking at like just above, somewhere like 60% up

6:05

from the bottom. Yeah, okay, makes

6:07

sense. Yeah, I'm about maybe like 75 or

6:10

so up from the bottom. But yeah,

6:12

if I didn't have any riser, the monitor, like

6:15

my eye level would be above the top of

6:17

the monitor. It's just on you. But I see

6:19

people do that all the time. I

6:21

can't. Yeah, it's

6:23

like, I think your neck would get

6:25

hurt. I think if you do, if you keep it

6:27

like that. What I want to

6:29

try is one of the very wide

6:31

curved monitors. I

6:34

think that would be really cool. Yeah,

6:36

you know, I've tried it. I have

6:38

one at work

6:40

and it's pretty good. It's pretty good.

6:43

I will say that the

6:46

one I have, the refresh

6:48

rate isn't as good. It's

6:52

not like a deal breaker

6:54

or anything, but you do like, if you

6:56

have one monitor, has twice the refresh rate

6:58

of the other, it can kind of like,

7:00

it's like when you're at the store and

7:02

all the differences between the TVs are so

7:04

noticeable then you take it home, totally

7:07

lose your frame of reference, right? So

7:09

if you have like a four to

7:11

three aspect ratio or whatever, like not

7:13

1080p widescreen 16 to nine, but

7:15

like if it's curved left and right, does

7:17

it also curve up and down if you

7:19

get a nice tall one, like, or is

7:22

like on a sphere? I've never looked it up. I guess I should. I'm

7:25

looking at it right now. It's

7:29

curved, but just, you know, it's just curved

7:31

like a cylinder. It's curved like a cylinder,

7:33

okay. Yeah, but it's very

7:35

wide and not very tall. So the

7:38

aspect ratio is not, it's not HD

7:40

aspect ratio. It's much wider. Oh,

7:42

okay. I think I would want one that, yeah.

7:45

I think I just want like a very large, like probably 8K,

7:48

but like, you know, big, but then I wouldn't actually

7:50

run it. You know, I would, everything would be scaled

7:52

up just so it's a comfortable eyesight thing. I

7:55

think 8K would be too small at like minimum

7:57

resolution or whatever. Yeah, right.

8:00

Right. But yeah, folks out

8:02

there, let us know your monitor setup. I'm curious. I

8:04

do feel like I could do better. And

8:08

yeah, curious to know what people's setups

8:10

are out there. Just chat us, email

8:12

us, post in Discord. Discord

8:15

is getting more popular, so people posting some

8:17

funny jokes. There is a video of this

8:19

professor pranking his class, which

8:21

I thought was hilarious. Wait, what? A

8:23

professor rained to their class? Okay, I had to go

8:25

on Discord. But pranking their class.

8:28

Oh, pranking. I said ranking. I

8:31

was like, oh. Yes,

8:34

we all know that they do that,

8:37

but I was supposed to actually do

8:39

it. ratemystudents.com, your website. All

8:42

right, well, we'll jump over to the news of

8:44

the show. Starting off since last

8:46

time, I mentioned this and then Jason

8:48

was excited about it as well. So I figure we'll

8:51

talk about it here. The

8:54

headlines, everyone's probably seen them, but I feel like

8:56

it's pretty cool for something that is a

8:59

memorable part of my childhood, which

9:01

is being absolutely crushed and being

9:03

terrible at the game of Tetris.

9:07

But now there has been someone

9:09

who has beaten Tetris. Actually,

9:11

as I'm recording this show, I think two people

9:13

have done it. So

9:15

the world record didn't last very long after lasting for

9:18

years and years. But Blue

9:20

Scooty, I think first name is Willis, beat

9:23

Tetris first, not at the earliest possible

9:25

time, which was accomplished now, but

9:27

did beat it. And here actually, the reason why I

9:29

think it's worth mentioning on the show

9:31

aside from just being a cool thing, and I linked

9:34

the video there that is the first place I saw

9:36

it, but it's interesting

9:38

how they define beat here. So when

9:40

Tetris was originally built, they didn't actually

9:43

have an end game in mind, which

9:45

is kind of unusual. It would just play

9:47

faster and faster. And I guess the assumption

9:49

would just, which is so fast, you couldn't

9:51

possibly keep going. And so eventually it would

9:53

die. A lot of games

9:55

actually that era are like that. Like Donkey Kong

9:58

actually, In Donkey Kong,

10:01

the amount of time you have to

10:03

finish the level goes down every time

10:05

you have completed a full

10:07

revolution of all the levels. And

10:10

basically, you get to a point

10:12

where there just literally isn't enough

10:14

time to finish the first

10:16

level, even if you're frame

10:18

perfect, and that's just how it ends. So

10:22

Tetris, I guess, gets faster

10:24

and faster. And then at some point, it

10:26

basically kind of caps out. It just doesn't

10:28

go any faster. And for a long time,

10:31

people would get to that area, that

10:34

speed, and then just sort of die pretty quickly.

10:36

If their row count was low, they

10:38

would be able to manage

10:40

to maybe get a few more lines cleared and

10:42

then die. But then recently, people discovered a new

10:44

way of pounding, tapping

10:48

the controller faster and

10:50

faster with this crazy

10:52

two handed technique. And they've

10:56

been able to go faster and faster and began to discover,

10:58

which I guess people had figured out via tool

11:00

assisted speed running. So they had kind of known

11:02

this would happen. But humans began to be able

11:04

to get there, which is levels where incrementing

11:07

the color palette left the predefined

11:09

color palette and would start using

11:12

actually machine instructions as the

11:14

color selection, which would result in just really

11:16

ill formed colors that made it even more

11:18

difficult. But then eventually, a

11:21

portion of memory would be accessed

11:23

that would just cause basically, you

11:25

know, a corruption of

11:27

the data. And so when that happens, the game,

11:29

the game just crashes and stops and just hangs.

11:32

And so this is what Blue Scooty managed

11:35

to do was to basically cause the game

11:37

to try to execute code that wasn't code,

11:39

and then hung the game. And so first

11:41

person to do that is just it's crazy.

11:43

It's very fascinating. It's also, and

11:46

it's the same, you know, as Jason was

11:48

mentioning, sort of frame perfect analysis for Super

11:51

Mario Brothers is some any sort of

11:53

speed running game that is from around

11:55

that era, the amount of analysis

11:57

and reverse engineering that goes into it and there

11:59

are even patch versions of the game so

12:01

that it doesn't get weird and you can keep

12:03

playing or just other things

12:05

where people really, really understand the

12:08

mechanisms that take place at

12:10

this end game and the amount of analysis. I'm sure

12:12

the programmers at the time had no idea that for

12:14

30 years, 40 years, people would

12:18

be thinking about what

12:20

that code that they wrote in the back of a

12:22

cubicle subware and turned out.

12:25

Yeah, it's totally

12:27

wild, right? I

12:30

think that

12:32

whole thing where they do this crazy, I mean,

12:34

you really have to see it almost in slow

12:37

motion this way with two hands. The

12:40

idea is every frame, in Tetris,

12:43

there's no inertia

12:45

or momentum or anything like that

12:47

with the pieces. So, every frame,

12:49

if you could get a press

12:51

left and a stop pressing left

12:54

in those two frames, then you could move it

12:57

over one whole

12:59

column. So yeah,

13:02

they do this weird thing where I guess they

13:04

hit the joystick from the bottom. So

13:08

in other words, if you imagine just pressing

13:10

with your thumb on a button, there's

13:13

only so fast your thumb can press

13:15

and release this button. But then

13:17

I guess they're saying, well, part of that

13:19

is just the mechanics of your body. So

13:22

what if you had another thumb on the

13:25

bottom of the controller? And

13:27

so one thumb is pressing and releasing, but

13:29

then the other thumb is pressing

13:31

the bottom into the first thumb.

13:34

And I guess by doing that, you can

13:36

get more presses than you could with just

13:39

one thumb. It's totally

13:41

crazy. You have to see it. I

13:43

mean, I guess Tetris lends

13:45

itself to that because I don't know.

13:49

We'd have to learn more. So I guess you only have

13:51

to move either left or right, as long as you don't

13:53

overshoot. And you only

13:55

have to rotate the piece three times in

13:57

a direction, and then you would just be

14:00

back. So you can only rotate 90 degrees. So

14:02

there's like a finite number of presses.

14:05

If you knew exactly what you were doing, your

14:07

path planning, you could be very

14:09

minimal inputs. Yep, yep,

14:12

totally. All right, on

14:14

to PowerWorld, accused of being an

14:16

AI product. So

14:19

yeah, so PowerWorld is wild. Patrick and I

14:21

were talking about it before the show. It

14:24

really is a great area,

14:27

a great theme for

14:29

a game. Basically, it's adult-themed

14:32

Pokemon with guns.

14:40

I think they're also just really aggressive looking.

14:44

You could actually catch

14:47

people in the Pokeballs and

14:49

sell them. So

14:53

it's basically a crazy, much

14:56

more like Mad Max. It's Mad

14:59

Max meets Pokemon. It's

15:02

a great idea of a theme. This

15:04

article is really interesting. Patrick actually found

15:06

this. It's

15:09

claiming that a lot of

15:11

the assets are AI-generated, but

15:14

they have no hard evidence.

15:18

There's really like two things that I

15:21

took away from this. One

15:23

is that the generative AI

15:26

is really here to stay. It's not

15:28

going anywhere. The days of downloading 30

15:30

gigabytes of MP3s when you

15:35

buy a game, I feel like those

15:37

days are very short-lived. I think

15:39

even if you did hire a

15:43

voice actor, you almost

15:45

certainly want to do some

15:48

type of capture of their

15:50

voice, and if nothing else, just

15:52

to reduce the storage costs and

15:55

generate their voice dynamically. So

15:59

that's definitely And then the other

16:01

thing is, it's amazing that they don't

16:03

know because I've seen a lot of

16:06

papers and other reports

16:09

where you can see how

16:11

something is generated by an

16:13

AI. But

16:16

I guess they have a point that it's really hard

16:18

to prove it. I

16:21

think the examples

16:23

I saw were interesting. For

16:26

example, if you see a... and this isn't a pal world

16:28

thing, but if you see a picture of a face and

16:33

the earrings don't match. If

16:35

it's a woman's or man's face, anyone's face,

16:37

and the earrings, they're wearing earrings and they

16:39

don't match, that's a sign that it's generative

16:42

AI because it's hard for the

16:44

AI to get

16:47

that symmetry right. But

16:51

they haven't really found anything like this here.

16:53

It might be just that

16:56

the person is starting with

16:58

an AI model

17:00

and then just as inspiration, but then

17:02

putting a human touch on it makes

17:04

it very hard to track. So

17:08

okay, a couple things. If you're going

17:10

to commit a crime, put on mismatched earrings

17:12

and do all the tips that are generative.

17:14

So if someone captures you on the camera,

17:17

you'd be like, clearly not me. Clearly

17:20

an AI. So

17:23

I sense a trend where people do

17:25

this. Second, a hat tip here to

17:27

Ace Rola. Ace Rola does

17:29

a YouTube video on shaders actually. Anyways,

17:32

and on Twitter, oh, X is where I

17:34

sort of first saw this controversy rising up.

17:38

But if you've never checked out him, check

17:40

it out, Ace Rola. And

17:42

then yeah, I think Jason's right. First of

17:44

all, does it matter? Like

17:47

if it's generative AI or not? And the

17:49

answer is maybe. It

17:53

sort of gets into one of those gray areas.

17:55

If it's fun, it's fun. But at the same

17:58

time, there are people trying to put work in there. into the

18:00

craft, right? It goes back to that debate,

18:02

which, you know, I don't think there is

18:04

any singular answer to, but, you know,

18:06

the difference between IP of furniture and, you know,

18:08

I heard, and I don't take medicine, real wood,

18:11

you know, piece of furniture. They're

18:13

both furniture, but, you know,

18:16

you could kind of talk at

18:18

length about, you know, various pros

18:20

or cons of each, and so,

18:24

I think it's, and, you know, as, I

18:27

don't know that even they have to be forthright

18:29

or honest about what they did, they just, you

18:31

know, probably shouldn't go

18:33

around claiming that it's high art, or, you know,

18:35

that, you know, they somehow, that there's, you know,

18:38

tons of people behind it, right? If you tried

18:40

to say, hey, you should support this game because

18:42

this took a lot of work, and

18:44

it didn't, then, you know, there's like a

18:46

sort of ethics problem, but as far

18:48

as, you know, as long as if I think right now,

18:51

they're not saying anything, they're just not

18:53

talking, it's, you know, been a kind

18:55

of overnight sensation, and I personally, yeah, it's

18:57

kind of interesting, but I don't know that

18:59

I have a specific problem with it. Yeah,

19:04

I think, as

19:08

a coder, it's hard to really relate, right? Like,

19:11

all of our code that we've done

19:13

on open source, you know, like, in

19:15

my case, like, Eternal Terminal and MAME

19:17

Hub and all these things, they're

19:20

all public repos, and so,

19:22

you know, AI is scanning those and

19:25

using them to build GitHub co-pilot and all these

19:27

things, right? So in a way, they're kind of

19:29

like copying it from me,

19:31

but it's okay, because I copied it

19:33

from Stack Overflow. Anyway. Ha ha

19:35

ha ha. So,

19:40

but artists don't feel

19:43

the same way. But

19:45

that's not, but that's not. But if I'm

19:47

not, I'm not an artist, so I can't

19:49

speak authoritatively, but it's very common when people

19:52

are learning to take inspiration to practice copying

19:54

and to understand what it takes, you

19:56

know, to make the paintings the paintings, and

19:59

it's not good to copy. copy too much, but

20:01

to be derivative, or you can even

20:03

see the lineage of how artists build

20:05

on other artists' concepts and extend them

20:08

and push them forward. There's

20:11

this very fine line between ripping

20:13

off Pokemon characters,

20:15

although if you look at other

20:17

places like Digimon, there's a lot

20:19

of Digimon monsters that look very

20:21

similar, and the same kind

20:24

of brouhaha didn't get it real. I don't know,

20:26

music is the same way. Everyone's

20:33

taking riffs and ideas from each other,

20:35

and there's been court cases recently where

20:38

it's, I don't know the answer.

20:40

It sure sounds really similar, but then again,

20:42

it's a nice sounding thing. If

20:46

you just sit there and play music until you find

20:48

something nice, you may play something that someone else has

20:50

already figured out before. This

20:55

is maybe, I'm trying to

20:57

think if there's other examples before

20:59

I say this, but I don't

21:01

really think so. I mean, let's

21:03

say this is all AI generated.

21:05

Somebody basically threw all the Pokemon

21:07

characters of all time into some

21:09

AI model, and now

21:11

they're able to spit out more Pokemon

21:13

characters. This

21:17

is really the first time where

21:19

we've seen some huge

21:22

commercial success come out

21:24

of some generative AI thing. People

21:27

are so worried about fake things,

21:30

like you're trying to impersonate

21:32

a politician or something like

21:34

that, but

21:37

this is not really that. I mean,

21:40

in terms of the incentive

21:42

is not to impersonate Pokemon.

21:45

Incentive is actually the opposite. It's to generate

21:48

something that has plausible

21:50

deniability that it came from

21:52

Pokemon. they,

22:00

you know, crash can.

22:02

So true. Right, like, and you know, but

22:05

to Jason's point, those don't experience the sort

22:07

of commercial success. The numbers I've seen are

22:09

absolutely crazy for how many people have bought

22:11

this. I haven't bought it yet. I'm

22:13

empty, because it actually does look hilarious. But,

22:17

yeah. My neighbors are actually going to play

22:19

it, so I'm feeling kind of

22:21

compelled to buy it. All

22:25

right. Well, hard pivoting off

22:27

of this one, I found a blog article

22:30

here, which is something that's been a

22:32

sort of, I don't even know how

22:34

to call it, not a meme, and like a picture

22:36

with an image macro or whatever pasted over top of

22:38

it. But just a sort of

22:40

meme, like, going around, which is kind

22:43

of absolutely silly ways to

22:45

solve determining whether a number

22:47

is even or odd. And

22:50

so I linked the blog here. The title

22:52

of the blog, it says the blog's name

22:54

is Blabin. But this is the only post

22:56

I saw on this blog. So I think

22:58

a new blog. But anyway, the link will

23:00

be in the show notes. But

23:02

this person was saying, based on TikTok, someone

23:04

get kind of ripped, which, again, I'm not

23:06

on TikTok, so this

23:08

is third hand at this point. But

23:11

getting ripped for saying that they determined

23:13

if a number is even or odd

23:15

by basically a bunch of if else

23:17

statements. So if number is one, odd.

23:20

If number is two, that's even. If number is

23:22

three, that's odd. I'm going to mess it up

23:24

already. Most people would

23:26

say, oh, would you just use a

23:28

modulus operator if you know what a

23:30

modulus operator is? Or oh, you use

23:32

bitwise and with the first

23:35

least significant bit just being one. And then

23:37

that'll tell you. There's a number of ways

23:39

to kind of do this check.

23:42

And most people would be expected as a

23:44

test of your language knowledge to know what

23:46

the modulus operator is at minimum or bit

23:48

masking, depending on the context. But

23:51

this person in the blog decided to take it

23:53

on themselves to for a 32-bit number,

23:55

which is 4

23:57

billion different numbers, write if statement.

24:00

And the interesting part and the reason I bring it up

24:02

is first just the absurdity of it. They

24:04

decided to write it in C with what

24:06

I sort of sounds like some tongue-in-cheek justification

24:10

initially. But what they

24:12

did, which is an actual interesting

24:14

thing to learn to do, and

24:16

on topic a bit for us

24:19

today, is to do code generation.

24:21

And so they wrote a simple

24:23

program, far simpler than a four

24:25

billion line program, to generate all

24:27

of the if statements automatically. And

24:30

that way they could produce that output.

24:32

And what does that take? Which is a useful

24:34

skill to be able to know how to do because there are

24:36

times when doing, not that, but

24:39

other code generation. Writing code to make

24:41

code is very useful. That didn't work.

24:43

The compiler, C compiler didn't like that

24:46

many lines. So then they decided to

24:48

output raw assembly and actually did

24:50

get it to work. And I guess that it was very

24:52

performant. If you think about it, it's

24:55

almost just a big lookup table and

24:57

you can just, there are jump tables, so you

25:00

can just basically jump to a set offset. So

25:02

if you know each if else

25:04

statement is two bytes and you had

25:06

a very clever assembler or whatever, you

25:08

could just jump based on the

25:11

number that many memory

25:13

offsets times two or whatever. So I

25:15

can imagine it being very, very efficient.

25:18

And then just having a table where it either outputs zero

25:20

or one. But yeah, so they actually

25:22

did manage to make assembly that they say works. Of

25:24

course, it's a, I guess we can

25:26

figure out four gigabyte file roughly. So

25:28

yeah, it's like, it's executable or

25:31

gigabyte. Ridiculous.

25:35

In that like there, this is of course, I don't

25:37

want to say this is a very silly way to

25:40

solve whether a number is even or odd, but

25:43

actually leads to some kind

25:46

of interesting computer science exercises

25:48

and doing this. And then of course, people responded, can

25:50

you do it for 64 bit numbers? And

25:52

the answer is no. Yeah.

25:57

I love how this, this is the

25:59

only post. in this person's blog. That's

26:02

okay, are you gonna post something up when you have a

26:04

cool idea and you wanna show people? Like, I don't fault

26:06

them. No, yeah, no,

26:08

I mean, I didn't mean that sarcastic

26:11

me. I literally love that this person,

26:13

you know, it's not like 10 posts

26:15

about, like, hire

26:18

me or self-aggrandizing or any of that.

26:20

It's just literally like, here's this cool

26:22

thing that I did, boom, blog. I

26:24

will say though, that's like a tough act to follow. So I don't know

26:26

what you make post number two. That's true,

26:28

yeah. I mean, you really can't. Just

26:31

started noodle. It's been a month now and

26:33

he hasn't made a post. That

26:38

is awesome. All right,

26:40

my next news is Seamless M4T.

26:43

Have you seen this, Patrick? No, uh-uh.

26:46

This thing is freaking wild. So this

26:48

is what I use to translate

26:50

the episode. So if you haven't done

26:52

this yet, go

26:55

to programmingthrowdown.com. Depending

26:57

on a bunch of factors, the very latest

27:00

episode might not have this. Just go back

27:02

an episode and you can listen

27:04

to us in Mandarin

27:06

Chinese. So

27:10

it's totally freaking wild.

27:12

So basically the way this works

27:14

is it

27:17

does the speech to

27:20

text. Now, like, you have to have a

27:22

separate file for each person. They have to

27:24

have a way of separating, or

27:27

in our case, we have a separate

27:29

MP3 for each

27:31

person on the show. But

27:33

it converts that to text and

27:36

then it translates the text to

27:38

other languages and then

27:41

it goes from that language's

27:43

text to one of several

27:45

voices that they have

27:47

for each language. And so

27:49

the reason why

27:52

they're calling it Seamless is

27:55

I don't think that it's end-to-end learned,

27:57

but it might be. But

28:00

it is separate sort of modules,

28:04

but the API and all

28:06

of that is extremely simple. You

28:08

basically just say, here's audio

28:10

and I want to get back text, or

28:13

I want to get back text and audio

28:15

in another language. I

28:18

tried at first translating English to English,

28:21

so it went from us to robot us.

28:24

That was really entertaining, and

28:27

then I started picking other languages.

28:30

This is amazing. I mean, it's amazing that it's

28:32

free. It's totally open source,

28:35

anyone can use it. I

28:37

actually bought for Black Friday a few

28:39

months ago, a GPU at

28:41

16 gigs of VRAM. That's

28:45

the bare minimum you need to run this model. But

28:49

if you don't have that, it's totally fine. I

28:53

also got this run on Google Cloud

28:55

Platform, and you pay about 50 cents

28:58

an hour, I think. Oh, wow. One

29:01

of those. Yeah, very reasonable.

29:04

You can even now they have something where

29:06

if it's idle for so many

29:08

hours, it shuts itself off, so you don't have to

29:10

worry about forgetting about it and getting a $500 bill

29:14

or something at the end of the day. Yeah,

29:18

all of that is super

29:20

convenient. You can

29:22

run it on Google Cloud. There's also Google CoLab.

29:26

You can run it there. There's some 16

29:29

gig VRAM GPUs there. I don't know if

29:31

the free plan would work, but the

29:34

paid plan is only 10 bucks a month. So

29:37

yeah, check this out. I mean, it's amazing. I

29:39

will say that there's two

29:42

modes. There's a

29:44

batch mode and a streaming mode. The

29:46

batch mode loads everything into

29:49

memory. So you can really only

29:51

use it for like a 10 second

29:53

file or something like that. The

29:56

streaming mode is really where it's at. The

29:59

document. The documentation is still pretty

30:03

nascent. What I

30:05

found really useful was they gave

30:07

a tutorial at NURIPS, which is

30:10

a AI conference. They

30:13

did a whole tutorial on

30:15

seamless M4T and you

30:18

can watch the video and follow along as

30:20

if you were at the conference for free.

30:22

I was able to find that. So

30:25

check it out, check out this tutorial. I

30:28

feel like this is really on

30:30

the vanguard of something super exciting.

30:34

I'm looking into, can we clone our

30:36

voices? Because if we could actually, if

30:39

it could be Mandarin Chinese, but it

30:41

sounds like us, that would be even

30:43

better. It's

30:45

like a football, your earrings match. Ha

30:49

ha ha ha. It's

30:51

gonna be like the deep fake Jason, but

30:53

yeah, speaking Mandarin. Yeah,

30:55

so if in a few months you

30:58

might hear Patrick and I in Mandarin,

31:00

maybe we'll swap out an episode

31:02

just for fun and see if people notice. I

31:05

hope people notice. No, no,

31:07

an old episode. Oh, I see, I see. People

31:12

focus the machine learning stuff

31:14

on the open AI and

31:17

I understand why and the approach to AGI, I

31:23

guess, general intelligence. You're

31:25

right, there's a lot of stuff happening out

31:28

in the call it periphery that feels

31:30

like we're really moving forward, especially once

31:32

we start combining some of these things.

31:35

There's been a long work separating back speakers.

31:37

People say they can't tell the difference between

31:39

us. So I don't know, maybe that'll have

31:41

to be Gen 2 of that. But having

31:43

a single file separating it back and then

31:47

running it through the system and combining it. But

31:49

also, I don't know that we've talked about

31:52

it, the sort of nerfs

31:54

and Gaussian splatting around making

31:56

3D models from pictures.

31:58

And right now they need. kind of a

32:00

lot of pictures of a specific kind, but

32:02

that'll get progress as well. And

32:04

then you can imagine the sort

32:06

of stable diffusion feeding into those

32:08

things. Like there's like

32:11

a lot of interesting sort

32:13

of like one, two iteration away

32:17

and probably requiring some leaps there because

32:19

it's not sort of like gluing normal

32:21

software together, but yeah,

32:23

there's a lot of exciting stuff happening that I

32:25

think it's missed for the focus on LLMs. Yeah,

32:28

I actually am more excited about

32:31

diffusion models and LLMs. We

32:34

should do a whole show on diffusion models.

32:36

All right, well, we know a person who probably speak to

32:38

that. It's not me. Yeah,

32:43

I was wondering if we knew a third person.

32:46

But yeah, have

32:49

you seen the diffusion model with Bomberman? No.

32:53

Yeah, so basically, okay, let me just do

32:55

a really quick and then we'll dedicate a

32:57

show to this. The way diffusion models work

33:00

is you have a bunch

33:02

of references. So in the case of Mario

33:04

or Bomberman or any of these games, you

33:06

have levels that were created by humans, right?

33:08

That's your reference. And you

33:10

wanna create more of those, right? So

33:13

what you do is you corrupt

33:15

the references, in

33:22

this case, the Bomberman levels, you corrupt them, but

33:25

the way you corrupt them is reversible. So

33:28

whatever you do, you know the exact way

33:30

to undo it. And

33:32

then you train a model to

33:35

reverse the corruption. All

33:37

right? And then once

33:39

you have that model trained, you

33:41

give that model random noise,

33:44

like levels that are complete garbage,

33:47

and you just tell it to reverse the corruption,

33:49

and you tell it to do it again, and

33:51

again, and again. And you tell it to reverse

33:53

the corruption until

33:55

it gets stuck in a cycle. When

33:58

it gets stuck in a cycle, you say, done and

34:01

that's your ballroom in level. It

34:08

should have guarantees on playability, like

34:10

not having something you can't reach.

34:13

So it's

34:15

all just AI, so there's no

34:17

guarantees of anything. You'd have to

34:19

do some fine tuning afterwards, but

34:22

it's like scarily true

34:24

to form. I

34:27

can't remember if they wrote something

34:30

to throw out the levels.

34:35

They wrote basically a validator and threw out all

34:38

the bad levels. Or if

34:42

they didn't actually make a real game with it, it

34:44

was a research paper. So they might have not bothered

34:46

to do that. But you see

34:48

the levels and it's like, yeah, that

34:51

looks pretty cool. I could see how that

34:53

could be kind of a fun ballroom in

34:55

level. We

34:57

should save it for the diffusion, but

34:59

I guess there's some randomness that goes

35:01

into how you select each operation. So

35:04

I guess almost backtracking, you could just

35:06

naively get towards the end and try

35:08

to go back and assign some attempts

35:11

or whatever and do

35:13

a validation at the end. Did I get a good level?

35:15

Did I get a validatable

35:17

level? Yep, yep,

35:20

exactly. Oh man, it's going to

35:22

be cool. The future is scary. We're all going to be

35:24

out of jobs. The future is

35:26

super scary. I definitely wouldn't want to

35:28

be in the games industry. As an

35:30

engineer, you would be fine. But if

35:32

you're a concept artist

35:34

or a voice actor

35:36

or something like that, it's going to be

35:40

different. There are some heads of

35:42

studios and stuff coming out and

35:44

basically forecasting reduced need for

35:46

a lot of those things. People

35:49

talking about cold

35:51

calling and sales calls and informational

35:54

sessions, maybe reduced need for folks

35:56

there. And then also some places

35:58

are going to be in the industry. getting flooded, there's

36:00

always been a sort

36:03

of like low bar

36:05

Kindle book, ebook, you

36:07

know, coloring book, drawing,

36:09

just like, you know,

36:12

low effort sort of written word kind of stuff. And

36:15

all of that, too, I think is this

36:17

AI stuff is sort of competing with not

36:19

the top tier stuff, but the sort of

36:21

like low tier low effort, people

36:23

turning those out, hoping one or two people buy them

36:26

or whatever, which has proven successful.

36:28

I think there's a threat to

36:30

those not that that's going to be a big

36:33

problem. But once they start targeting people who are,

36:35

you know, higher up the food chain there,

36:37

that's that's going to be a struggle. And

36:40

I will weirdly segue that into our

36:42

book of the show from high quality

36:44

books that are they're definitely not AI

36:46

generated. That's right. So

36:49

my first one, I tried, I might have

36:51

recommended it before if I did. Well, it's

36:53

worth a second recommendation. I tried looking, but

36:55

after 171 shows, it's a it's a bit

36:57

of a process to try to search for

36:59

it. And that is

37:01

foundation by Isaac as as mob,

37:04

which is a actually many book

37:06

series. And

37:08

the first one is, you know, great place to start. And

37:11

recently, this became a TV show, which I

37:13

think renewed some interest. The TV show doesn't

37:15

follow the book super closely.

37:17

But if you've never read

37:20

some of the classic science fiction, it's

37:22

really like a fascinating trip to see

37:24

how close

37:27

some of the stuff got from people

37:29

writing long before, you know, computers were

37:31

a thing, much less mobile phones, some

37:34

stuff is just like laughably wrong. And

37:36

some stuff is just like, wow, that's

37:38

eerily the same issues we're dealing with

37:40

today. And so reading classic science fiction

37:43

is something we're doing if you've never

37:45

tried it before. And

37:47

the foundation series is a I feel

37:49

like a pretty formative series of science

37:51

fiction. And just to give

37:53

people flavor, since I've not said anything actually about the

37:55

book is the idea

37:57

is there's a an empire

38:00

are ruling the galaxy and there's

38:03

concern that these

38:07

people raise that the empire is going

38:09

to collapse and it's going to cause

38:11

humanity basically to be set back and

38:13

really be a struggle and everyone's going

38:15

to be bad off. And so they've created a

38:18

sort of way to help shortcut that to

38:20

make it better. But of course, the empire

38:22

itself is very unhappy with this. And

38:25

the whole prediction that this was going to happen is

38:27

this, of course,

38:29

fake, but it sounds very convincing

38:31

psycho history, which is this idea

38:33

that you cannot predict individuals, but

38:36

that, you know, sort of like

38:38

I think the analogy they use is like

38:40

a gas. You can predict a lot

38:42

of statistics about gases, even though an individual

38:44

molecule in a gas is, you

38:47

know, very, very difficult to predict. And so

38:49

through that, they can kind of predict the

38:51

course of human history and how things will

38:53

go and make updates and help keep it

38:55

on, you know, a plan that will, you

38:57

know, sort of benefit the most humans. And

38:59

it's just a very interesting read in the

39:01

dynamics. And so if you've never read it

39:03

before, and if that sounds at all interesting,

39:05

although I probably did a poor pitch of it,

39:07

or if you've watched the TV show and maybe

39:10

didn't realize it was also a book, I'll

39:13

pitch Foundation by Isaac Asimov. Yeah,

39:16

did you read it recently? Or is that when

39:18

you read? I read it actually as a teenager.

39:20

So I read it a long time ago. Yeah,

39:22

same here. I have to confess, I don't remember that

39:25

much of it. But I do remember having a big

39:27

impression on me when I read it. I

39:30

think I also had kind of forgotten I read it. And

39:33

then I like looked up the sort of summary and

39:35

I was like, Oh, I remember. And

39:37

then I actually have watched, I think there's a couple

39:39

of seasons now of the TV show. And

39:42

I will say, you know, it's a pretty dark,

39:44

dark thing to not watch with kids,

39:46

but pursuing

39:48

the same kinds of ideas. And I thought

39:51

I thought I like it, even though it

39:53

doesn't follow the book that closely. It uses

39:55

some of the concepts and the sort of

39:57

setup to kind of examine some of different

40:00

different ideas but in a similar vein. Cool,

40:05

yeah, definitely. Folks haven't read that. Definitely give

40:08

it a read. It's a great series. My

40:11

book of the show is Propaganda

40:13

by Edward Bernays. So

40:17

this is a fascinating book. It's

40:21

so wild that I almost, you

40:23

know, I really, I

40:26

wouldn't take it all as ground

40:28

truth, really. I mean, a

40:31

book about propaganda might be propaganda. You know, it's

40:33

kind of like meta, but. But

40:37

basically the premise, which they get right

40:40

into in the book, is that, and

40:46

again, this is not my theory

40:48

on life, but that basically, you

40:51

know, democracy can't work.

40:54

And so you

40:57

really need to have just like a few

40:59

different ideas to follow. It can't just be

41:01

a total free-for-all. I

41:04

mean, a good example is the app

41:07

store that Patrick was talking about, where there's

41:09

like a million knockoffs. Like you could search

41:11

pretty much any word in the dictionary, and

41:13

you're going to find a video game based

41:15

on that word. And they're all kind of cookie

41:18

cutter. And there's no, it's very hard to get noticed.

41:24

In the app store or to find good content. And

41:28

so you're really relying on the, you know, editors picks. And

41:31

so in a way, it's like you have this really democratic

41:33

platform, but what it really degenerates

41:35

to is just

41:37

like a handful of editors picks and

41:39

folks who have a big audience already and

41:41

all of that. And

41:44

so the claim by the book by the

41:46

propaganda book is that, you know, there's just

41:48

so much content, and this was written 100

41:50

years ago, 19 years ago. Yeah,

41:54

there's just, there's so many clubs that you could

41:56

be a part of. There's just so much, so

41:59

much. many choices, so many

42:01

brands, so many of this, that

42:04

really propaganda is the way

42:06

by which 90%

42:10

of your options get filtered out and you

42:12

can just focus on the top 10%. So

42:14

it almost becomes a

42:18

way to ante in. It's

42:20

like, okay, you have to build

42:23

this propaganda machine to

42:26

be part of of the system

42:29

and everyone who doesn't do that ends up

42:31

just getting kind of lost, right? And

42:35

it dives into how

42:37

propaganda works as a bunch of examples.

42:40

Some of them were pretty mind-blowing. Yeah,

42:45

I won't spoil them, but maybe

42:48

I'll spoil one. There's this

42:50

cigarette company that they

42:55

were under a lot of pressure. There were a lot

42:57

of moms who didn't want their sons

43:00

and daughters smoking because they had

43:02

heard about all these issues. I

43:04

don't know if lung cancer was a really known entity

43:06

in the 1920s, but they

43:08

thought there were health issues. And

43:11

so they were able

43:13

to start up this

43:16

Women's Liberation March sponsored

43:19

by Marlboro. And

43:22

they basically tapped into the

43:24

women's liberation movement of the

43:26

1920s as

43:29

sort of like a

43:31

back pressure against this

43:34

kind of like Mothers Against Smoking

43:36

group. And the

43:38

whole thing is just blowing my mind.

43:41

I mean, it goes without saying that. I

43:43

think that's fair to say. Patrick and I

43:45

are task oriented in

43:47

a sense. We're definitely not master manipulators.

43:55

We're not like these kind of people. Patrick, do

43:57

these even

44:00

have a social media account. I barely use

44:02

my social media account. And

44:05

so for me, this is like a

44:08

whole different dimension to, you

44:10

know, humanity, really. I mean,

44:12

it's something that I never would

44:14

have really considered or thought of if I

44:17

hadn't been recommended this book. So I

44:20

found it absolutely fascinating, highly

44:22

recommend it. Very interesting.

44:26

Yeah, I think sometimes

44:28

words get

44:33

like artificially intense negative things. So I

44:35

think like some of the things you're

44:37

saying, the other one I'll kind of

44:39

by analogy or by similarity talk about

44:41

is politics. So like people have I

44:43

don't want politics in the office. Like, what

44:46

you need to be aware, regardless

44:48

of whether you want to quote

44:50

unquote play politics, politics is a

44:52

like human way of, you

44:55

know, that things happen and decisions get made

44:57

and, you know, back door, back room decisions,

44:59

you know, these kinds of you have to

45:01

be aware of them. If

45:03

you, you know, want to kind

45:05

of like, at least have some modicum

45:07

of control over what happens. And I

45:10

think by extension, propaganda similar, it's, you

45:13

know, it has a very, very negative tone to

45:15

it. But it, I mean, it's, it's

45:17

a way of lots of people doing stuff, they

45:19

may not see it as propaganda, right? They just

45:21

see it as, hey, I'm trying to get my

45:23

ideas across or find a way to make people

45:25

more open to this. But sort of

45:27

calling it out and putting a label on it and saying how common

45:29

it is, is a way of sort

45:31

of engaging with it. Yeah,

45:33

and it turns out actually the

45:36

negative connotation to prop to the

45:38

word propaganda is also propaganda. So

45:42

the word they actually talk about this,

45:45

the root of the word propaganda comes

45:47

from the

45:50

Catholic Church in like the

45:53

1600s had a like

45:56

a part of seminary where they were

45:58

kind of teaching priests

46:01

and bishops and cardinals

46:05

about how to kind of spread

46:07

Catholicism. And I think

46:10

that's where the word actually comes from. And then

46:13

I think, and so at

46:15

that time, they had a

46:17

positive connotation. And I think the

46:19

connotation flipped over time as a

46:21

society we got kind

46:23

of like, you know, not happy

46:26

with like proselytizing. And then

46:28

now it's like really like

46:30

commercial propaganda, and then all of

46:32

that. So yeah, like

46:34

the propaganda, I think collided headfirst into

46:37

the Enlightenment and lost when it comes

46:39

to, you know, reputation as a word.

46:43

But yeah, it's, it's, yeah, but the book

46:45

is totally mind blowing, highly recommend people, people

46:47

read and to Patrick's point, and

46:50

we talked about this in the marketing episode,

46:52

we had an episode of the gentleman from

46:54

marketing, you know, like, you have

46:56

to, I'll give you a really

46:59

concrete example. You know, I made

47:01

that game AI hero, right? I

47:04

made it totally free. There's

47:07

no ads, there's no in-app purchases or

47:09

anything like that. You know, I told

47:11

my friends and family about it, all of that. And

47:14

it has I didn't check

47:16

recently, but it has, I

47:18

think, like 100 downloads. And

47:21

now, you know, I made it, you know, to

47:23

be frank, I kind of made it for myself.

47:25

I mean, so I'm not out there trying to

47:27

get a bunch of downloads. But I was even

47:29

still surprised that it got

47:32

such, such, such little notice.

47:35

And it really just doubles down on

47:37

that point that, you know, you

47:40

have to get a

47:42

propaganda cycle going a marketing cycle

47:44

going for anything that you want

47:46

to have mass appeal. Otherwise, there's

47:51

just too much content out there. So

47:54

yeah, it's thought of propaganda, marketing, you know, these aren't

47:56

words that you should be afraid of. I'll

48:01

say that it's not something that at least

48:03

I'm, I don't know about Patrick, but it's not something

48:05

that I personally am very good at. It's definitely something

48:07

where I try to partner with

48:09

other people who are much better at

48:11

it than I am. But

48:13

it's something that I think we all

48:15

should really appreciate. It is very important.

48:18

If I did want AI

48:20

Hero to get a ton

48:22

of people, I

48:25

would have to go about things very

48:27

differently. I think I'd have to be

48:29

posting regularly on Reddit. I'd have

48:31

to figure out some way to maybe

48:34

gin up some controversy. Maybe I'd make

48:36

a fake post saying that it's generative

48:38

AI, pretending to be somebody else attacking

48:42

me for using generative

48:44

AI. I don't know, but this is

48:46

just from reading the book. There's a million things you could

48:48

do to amp up

48:51

your thing, whatever it is. But if you

48:53

don't do that, probably

48:55

no one's going to pay attention. That's

48:57

true in politics. If you

48:59

make a political party, nobody's really going to care.

49:02

It's true in most

49:05

things. It's just a

49:07

fact of life. Yeah, there's

49:09

a lot to say here, but probably just

49:11

move on for now as they get it.

49:13

All right, yeah. Keep moving forward. Time for

49:16

Tool of the Show. All

49:18

right, what's your tool? Not a

49:20

tool, a game, but classic Patrick Koppout.

49:22

Mine is, I've been getting into these recently,

49:24

but this is the one that I encountered

49:26

first, which is The Room. This is pretty

49:29

old at this point. Most people

49:31

probably have played it before. If not,

49:33

I would encourage you to check one

49:35

of them out. Often, they're very cheap

49:37

or free on Android, iOS. I think

49:39

it's just a Steam version, probably a

49:41

web version somewhere. But the idea is

49:43

basically like an escape room in an

49:45

app. Just like without

49:48

the time limit, you're just like a series of

49:50

puzzles, and you

49:52

interact with them. For me, I've actually

49:54

never done an escape room. I

49:57

want to. It just hasn't been a thing that I've been

49:59

able to do. to do, but I'm sort of fascinated

50:01

by the concept and these games are just like an

50:03

easy way to spend a few minutes sort of playing

50:06

with something and trying to figure it out. I will

50:08

say in the genre some games do a better or

50:10

worse and I have my own particular sort

50:12

of like I don't like things that

50:14

you're just supposed to try random stuff until they happen.

50:16

There should be some clue that you

50:18

can look for and it can be obscure or it

50:21

could be that you have to pay attention or whatever,

50:23

but sometimes they fall into like how

50:26

was I supposed to know that? Like

50:28

there's no indication that you're supposed to

50:30

touch the top of the windowsill and

50:32

it's going to be movable. It's

50:35

like okay, but sometimes you fall into this.

50:37

But anyways, I guess

50:39

a pitch for these kinds of

50:42

puzzle escape room games in general

50:44

and there's many in the genre,

50:46

but for me the first one

50:48

that I sort of bumped into was the room

50:50

series. I think there's like now four or five

50:52

in the series, but shout out

50:54

to the original one and if you've never

50:56

played one before, you know, check

50:59

it out. Yeah,

51:01

totally. I've played The Room. I think

51:03

it's great, a lot of fun. It

51:05

taps into your common sense. You do

51:07

have some intuition into what the

51:09

answer to the puzzle is. My

51:12

tool of the show is also somewhat of

51:15

a cop-out because we've had them on the

51:17

show before. We did in fact had a

51:19

whole episode dedicated to Incredibuild, but

51:21

I was building a new

51:23

version of Mamehub on my

51:26

house today, I guess, because it's like using all the desktops

51:28

in the house. It's kind of the point of the tool.

51:32

And I just thought to myself, man, this is such

51:34

an amazing tool. I've used it for so many years

51:36

for free. If you're

51:38

using it for your home use, it's

51:40

not for professional use. It's totally free. I

51:43

felt like they deserve another shout out

51:45

after so many years. We've gotten tons

51:47

of emails from folks who have

51:51

got their company to buy Incredibuild and

51:53

all of that. We have been able

51:55

to drive some business to them, which

51:57

I'm really proud of. That's

52:00

Incredibilt. Basically, the way it works

52:02

is it hooks into your build

52:04

system. It even has plugins for

52:07

Visual Studio. So if you're building on Visual

52:09

Studio, it works. If not, it

52:12

hooks into GCC and all that stuff. And

52:15

instead of choosing Build

52:17

Solution for Visual Studio,

52:19

you choose Start Incredibilt.

52:22

And I have the Incredibilt

52:24

agent running on all the desktops here in the

52:26

house. And the fans all start roaring and they

52:29

all start working together

52:31

to build stuff. So Mame

52:33

Hub takes, I think, like two

52:35

and a half hours to build. But

52:39

with Incredibilt, I can get it done in

52:42

like 10 minutes or something. So

52:45

it's super nice and highly

52:47

recommend it. Very

52:50

nice. Very nice. All

52:52

right. Well, I think it's time

52:54

for our topic, which is compilers

52:56

and interpreters. Yeah, this

52:58

is a request by Jessica W. I

53:00

won't say your last name. I know some people

53:02

might census that. But thank you so much, Jessica,

53:04

for this idea. It's a great one. All

53:08

right. I didn't know Jason sort of bowed out. It's

53:10

not my background. So it kind

53:14

of fell to me. And I struggled a bit with

53:16

the tact to take here because there's a lot to

53:19

be said. This is a big

53:21

request. So I decided to take a

53:24

stab at what I'll say

53:26

is a sampler, kind of going through

53:28

a bunch of different topics in

53:30

the area with some

53:33

sort of high level overview. But

53:35

choosing an interpreted versus

53:37

compiled language. I guess you could say choosing a

53:39

compiler versus interpreter. But most of the time, if

53:41

you choose a language in the pros and cons

53:43

of language, you're sort of choosing

53:45

one of these for that. But then in

53:47

each of these, there's just an incredible depth

53:51

you can go into or not, you

53:53

know, most of the time, I guess,

53:56

we're big believers and you know, the right tool

53:58

for the job. despite the fact that

54:00

I may throw stones at

54:02

Python, you know, a lot of

54:05

times, you're only going to run an analysis once

54:07

or, you know, it doesn't really even really matter how

54:09

long it takes. And so you

54:11

can get this just really big worry

54:13

about speed or performance or, you know,

54:15

selecting exactly the best tool. But I

54:17

will say, most of the programs I

54:19

write are probably run less than a

54:21

dozen times ever, even to

54:23

check them in and put them in at work,

54:25

you know, and you, I may

54:27

run it a few times, someone else may use

54:30

it, we may copy and paste the code around,

54:32

but any given instances is just not that. And

54:34

then, and then a very few are, you

54:36

know, run hundreds of times every day, and you know,

54:39

or thousands of times, interloops and calls

54:41

and those ones. And so there's

54:43

a really, a really wide range. And

54:46

so find a few things

54:48

that you're you're sort of proficient in. And I'll

54:50

say about way of disclaimer before we dive in

54:52

here is just sort of like, you'll

54:55

see a lot of internet flamewars about,

54:57

you know, oh, that that's slow, because it's, you

54:59

know, scripting, or, you know, don't if you're going

55:02

to build something in Godot, don't use as a

55:04

GD script, because it's, you know, it's going to

55:06

be slow. And it's, I

55:08

don't, I mean, if you're finding yourself

55:10

in a problem, and maybe you want to listen

55:12

to some of that, or being aware is good.

55:14

But I feel a lot of people hesitate to

55:17

take the first step and get what you know,

55:19

call analysis paralysis, you know,

55:21

from making a decision and actually better

55:23

to just build something and let it suck

55:25

and be slow and, and introspect why at

55:27

the end of getting somewhere with it and

55:29

then you know, make a follow up choice,

55:31

then to never take the first step. Yep,

55:34

totally. There's a balance there. But

55:36

okay, off of my soapbox. All

55:38

right. I guess

55:40

anytime we run a program, we're talking about, you

55:42

know, a processor. And we were talking in the

55:45

Christmas episode, holiday episode, Jason

55:48

was mentioning, oh, and I already forgot if it

55:50

was risk V or risk five, I think risk,

55:52

risk five. Yeah, resounded. Okay, good. Risk five and

55:54

risk five is an instruction

55:57

set architecture, a sort of way of

56:00

of having computers run and it has, I guess,

56:02

what you would call machine code. So out

56:05

of, you know, wherever it's

56:07

loading the program, probably RAM, and then

56:09

it sort of loads a set of

56:12

bits, right? If it's a 64-bit processor,

56:14

it loads, you know, 64 bits and can

56:16

kind of look through there. And part of

56:18

that is the operation to perform in some

56:20

instructions about to load it from a register

56:22

or to load it from a place

56:25

in memory or whatever. And then the

56:27

processor sort of handles that. And that

56:29

is machine code. If you ever do

56:31

like NAND to Tetris, or there's another

56:33

game where you build logic gates out

56:35

of NAND on your web browser, or

56:37

you take a class in university where

56:39

they're sort of teaching you about sort

56:42

of building up from like VHDL, you know, how

56:44

to kind of like, you know, implement a processor,

56:47

you'll end up realizing it really is

56:49

just, you know, hex numbers on a

56:51

screen that you, you know, end up

56:53

getting executed in their, that's your program.

56:56

And every kind

56:58

of family of processors has a different set of

57:00

instructions, a different way of organizing those operations, and

57:03

to write a program in it, you know, you

57:05

would have to sit there and really write, write,

57:07

you know, a hex, you know, or you could

57:09

write binary too, but, you know, most people would

57:11

write it in hex. And that's the way we

57:13

sort of think about it, because it gives you

57:15

the nice byte delineation. And

57:18

you would not do that after about

57:21

maybe one time of doing that, you would not

57:23

want to do that anymore. And so as an

57:25

example, like when we did Motorola 68k

57:28

processors, which is just, you know, one of these

57:30

families, when I was in university, and we had

57:32

to do this as a task, like, you know,

57:35

write some, you know, machine code. And I did

57:37

that once before sort of realizing, wait a minute,

57:39

I'm just going to write a program to be

57:41

like a crappy assembler, and,

57:43

you know, do that. And so then that moves us

57:45

to assembly language. And so assembly

57:48

language is like a very

57:50

light skin over this

57:52

machine code. So you're pretty much

57:54

having one to one correspondence, but

57:56

you're writing English symbols. So instead

57:58

of hex code, code 47

58:01

being the move operator where

58:03

you move one set

58:05

of bytes to another location, you would

58:07

say MOV, move, right? That's a lot

58:09

easier. And then the registers each have

58:12

names rather than just numbers like R8

58:15

or whatever for register 8. And

58:18

so this is the first time we encounter

58:20

what would you would call a compiler. And

58:22

the compiler takes those English

58:24

letters or whatever language you're writing in

58:27

letters and maps them directly and emits

58:29

the bytecode. So

58:31

does that mean that it's reversible? Like, can

58:33

you go from machine code to assembly code?

58:37

Yes, great, great question. So that you

58:39

can it's called disassembly. And for

58:41

assembly, and I'll talk about a caveat here

58:43

in a second, it's pretty straightforward. So if

58:45

you take a program that lives and you

58:47

haven't gone, we had, oh, that was way

58:49

that was many years ago. But we had

58:51

the folks from I think Intel in here

58:53

talking about obfuscating your program codes that people

58:55

can't do that. And they

58:58

can't sort of like patch it or do

59:00

what would in video games would be hacking

59:02

or, you know, and more critical software trying

59:04

to get your keys or something. But yeah,

59:06

so you can do disassembly. So you can

59:08

take the bytes flowing through your processor and

59:10

sort of convert them back

59:12

to assembly because yeah, it's

59:14

a very direct mapping. Got

59:17

it. Okay. So the

59:19

caveat there that I was already alluding to, and

59:21

you can can help here, it's not too bad

59:23

in assembly, is what I've described so

59:25

far, you kind of do in a single pass.

59:27

But that also turns out to be easier

59:30

to do better than and you know, it's frustrating, so you wouldn't

59:32

want to stay there very long, which is you

59:34

may want, you may want to have an example where

59:36

you have a loop. And so when you're

59:38

on a loop, you want to go back in your

59:40

program to somewhere previous, very pretty good forward if you

59:43

have an if statement. And

59:45

if you were doing what, you know, I described initially,

59:47

and that's kind of like a single pass compiler, you

59:50

would have to calculate, you know, go down, figure

59:52

it out as eight instructions for my loop. So

59:54

I need to go back to that branch statement

59:56

and say jump eight instructions down, that'd be really

59:58

annoying. So What people do

1:00:01

is implement the ability to add labels so you can put

1:00:03

a label You know end of

1:00:05

loop and you can say you know

1:00:07

jump JMP and then you can put end of

1:00:09

loop The issue is when

1:00:11

you're doing a single pass compiler you're scanning down.

1:00:13

It says jump end of loop But

1:00:15

it's never seen the symbol end of loop So

1:00:18

it does where to jump to right and

1:00:20

so now you get what we call sort

1:00:22

of a two pass compiler So now you

1:00:24

start to get what you would kind of

1:00:26

think about variable names and labels and jump

1:00:28

statements It's not really that

1:00:30

much extra But it your productivity goes

1:00:32

way higher and for many years people

1:00:35

coded an assembly with two pass compilers

1:00:37

and the two pass just means first scans through

1:00:40

to find all of the symbols that are names

1:00:42

and Their you know locations and

1:00:44

then on the second pass does the actual

1:00:46

emit the machine code and now it knows

1:00:48

Oh this offset is you know this many

1:00:51

instructions down and it's able to produce the

1:00:53

machine code That's it. Does it does it

1:00:55

literally do it in two passes because I

1:00:57

could also imagine like anytime you see a

1:01:00

jump forward You just keep track of it

1:01:02

and then you go back and fill it

1:01:04

in I Mean,

1:01:06

but that sure but that's still you can't do

1:01:08

it in a single It's not one pass because

1:01:10

you have to go back up right and right

1:01:12

in it So I guess

1:01:14

like the big O notation kind of thing like

1:01:16

how do you want to call it? I'm sure

1:01:19

I'm sure they'd get pretty sophisticated. There's probably you

1:01:21

know, it's just calling out that the

1:01:23

progression I guess in here, but still

1:01:25

these Assembly languages

1:01:27

you're writing in, you know, there's kind

1:01:30

of some asterisk here, but for the

1:01:32

most part you're writing it per You

1:01:35

know kind of processor So if you want to write

1:01:37

it on a you know if you're gonna use an

1:01:39

Arduino, which is I think based on a pic chip,

1:01:41

then you need to use the pic flavor of assembly

1:01:44

if you want to do this in You

1:01:47

know Motorola 68 K x86

1:01:50

processor arm processor if you're you

1:01:52

know gonna run on a phone Every

1:01:54

one of these has a different set

1:01:56

of instructions and therefore a different assembly

1:01:58

language. And so again that did it's

1:02:00

really crappy if you want to ever

1:02:02

write for more than one thing or

1:02:05

you want to go faster because you're

1:02:07

pretty much still basically writing one line

1:02:09

of code per instruction, which

1:02:12

is going to make you very easily

1:02:14

able to sort of intuit about sort of

1:02:16

like runtime and complexity of things a

1:02:18

little easier than a high level language. But

1:02:21

again, it gets kind of frustrating. And there

1:02:23

are concepts for still everything that's

1:02:25

in a high level language sort of has to

1:02:27

be capable of being done in assembly language. So

1:02:29

you still see things like doing function calls or

1:02:32

jumping to a function and pushing stuff onto the

1:02:34

stack. For some

1:02:37

processors, those things are strictly implemented

1:02:39

by a higher language compiler. But

1:02:41

some processors actually have support for

1:02:43

that even at the assembly language

1:02:45

level. The newest sort of

1:02:47

start to call those things complex instruction

1:02:50

sets, Sys versus risk reduced instruction set

1:02:53

computers. And so there's a whole

1:02:55

separate topic. We'll sort of leave this

1:02:57

here because we'll go forever and move

1:02:59

up the family tree,

1:03:02

I guess, to higher level

1:03:04

languages. Yeah,

1:03:08

that makes sense.

1:03:10

So every programming language

1:03:13

that you read about, C, C++, Java, Python,

1:03:17

they're all considered high level. Yeah,

1:03:20

yeah, yeah. I mean, I

1:03:22

don't, there's degrees to that, I guess, you

1:03:25

know, but at least

1:03:27

when I sort of started learning about this, and you know,

1:03:29

they shift over time, right? There was early

1:03:31

on, it was you writing an assembly or

1:03:33

you're writing in, you know, something that wasn't assembly

1:03:35

and anything that wasn't assembly was, you know,

1:03:38

high level. And the idea there being,

1:03:40

in my mind, at least the delineation,

1:03:43

and it may be it's moved over time. But

1:03:45

if you write a line of

1:03:48

code, and it produces sort of

1:03:50

an arbitrary number of machine instructions,

1:03:53

then you're now writing in a

1:03:55

high level language. Got

1:03:57

it. Okay. So in a line of

1:03:59

C code. just as an example or

1:04:01

Java or whatever, you can write A plus

1:04:04

B divided by C times D

1:04:07

to the power two, whatever, right?

1:04:11

That's one line, but it's many, many, many assembly operations

1:04:14

to do that depending on architecture. And

1:04:17

the compiler now is able

1:04:19

to target different backends. So if you write, and

1:04:21

we'll talk about CC++ here for

1:04:24

a second, if you're writing in

1:04:26

CC or C++, you can compile against

1:04:28

many different processors. So you could write

1:04:30

one program that runs on ARM or

1:04:32

on x86 because the compiler

1:04:35

is picking up your code and we

1:04:38

won't go into it, but building, sort

1:04:40

of finding the symbols, building a syntax

1:04:42

tree, and it knows how to emit

1:04:44

the proper machine code for executing

1:04:47

that program. And it does, it can

1:04:49

do that with many passes, depending on

1:04:52

the compilers, but many compilers also emit

1:04:54

a sort of intermediate representation. So even

1:04:57

different frontends, so you could say,

1:05:00

like an LLVM, you'll see

1:05:02

things that can target, you

1:05:05

know, the LLVM IR, intermediate

1:05:07

representation, which is something,

1:05:09

which means the sort of machine code

1:05:12

assembly and the high level language that

1:05:14

Watts and lots of frontends can compile

1:05:16

into. And then there's a specific set

1:05:19

of operations and libraries and team

1:05:21

working on taking that intermediate representation

1:05:24

and compiling it down to your

1:05:26

specific final machine. And so

1:05:28

then that's called the backend. So you have

1:05:30

the frontend, compiling it to intermediate representation and

1:05:33

then the backend, taking it from intermediate representation

1:05:35

to a specific class of

1:05:37

processor. Got it,

1:05:39

I see. So if you wanted to write a new

1:05:41

language, you

1:05:44

could create a language that

1:05:46

compiles to the LLVM immediate

1:05:49

representation, and then you'd

1:05:51

be guaranteed that it would run on

1:05:54

all these different processors. And

1:05:56

not only that, you're also gonna benefit from

1:05:58

a bunch of optimizations that. the

1:06:00

sort of like imagine loop unrolling. So

1:06:02

you write a loop in this intermediate

1:06:05

representation and now the sophisticated folks across

1:06:07

all these languages, economies of scale kind

1:06:09

of thing, can implement loop unrolling or

1:06:11

some stuff we're gonna talk about later,

1:06:13

but it can implement it at the IR

1:06:16

level and then you can benefit from it. Got

1:06:18

it, cool, that makes sense. So

1:06:20

now you mentioned Java as well. Java

1:06:23

gets a special shout out

1:06:25

here, which is that

1:06:29

when Java is compiled and this starts

1:06:31

to say, you know, these are words

1:06:33

we use, but you're

1:06:35

no requirement that it has

1:06:37

to map cleanly. So Java

1:06:39

also targets sort of an

1:06:41

intermediate representation called the JVM,

1:06:44

the Java Virtual Machine byte code. And

1:06:47

so it does get compiled and it has

1:06:49

all this optimization and stuff that

1:06:51

can happen. And then it produces

1:06:54

basically a machine code, but the

1:06:56

machine it targets is the Java Virtual

1:06:58

Machine, not an individual processor. And when

1:07:00

it was first developed, this was a

1:07:03

huge boon because now you

1:07:05

talk about portability, you can run on anything

1:07:07

that there was a JVM for, the JVM

1:07:09

for, and LLVM wasn't really a big time.

1:07:12

So, you know, again, times change, but

1:07:14

at the time, this was like, you know, it's like a

1:07:16

really big thing and Sun Microsystems

1:07:18

at the time, you know, we're sort

1:07:20

of pushing that, hey, Java really, you

1:07:22

know, runs on, I forget, I had

1:07:24

an ad, you know, some obscene number

1:07:26

of devices and, you know, has this

1:07:28

ability. And so there you're compiling it

1:07:30

down. And then the Java Virtual Machine

1:07:33

has an implementation per, you know,

1:07:35

kind of architecture. So it has an ARM

1:07:38

implementation and it has an

1:07:40

x86 implementation. And the implementation

1:07:43

of that virtual machine is to

1:07:45

take that byte code and pretend

1:07:47

it emulates, right? Emulates this sort

1:07:50

of conceptual computer that is like

1:07:52

a, almost like a lowest common

1:07:54

denominator, but on some processors,

1:07:57

it may be able to be very efficient with a

1:07:59

certain option. and others not, but you don't

1:08:01

have to worry about that because it's

1:08:04

sort of just handled for you.

1:08:06

And all of the standard libraries

1:08:08

can have sort of special treatment

1:08:11

or efficiencies added. And so this

1:08:14

was a very interesting approach, but it sort

1:08:16

of threads the line here where you have,

1:08:19

it's not a scripting language, we'll talk about that

1:08:21

in a second, but it's not a true compile

1:08:23

in that there's still an emulator, a virtual machine

1:08:25

as it were, that sits in the middle here

1:08:28

and sort of that's the program that's actually

1:08:30

running. So that program is running your program.

1:08:34

And so the compiler is not targeting a machine,

1:08:36

the compiler is targeting, well it is targeting a

1:08:38

machine, but it's not targeting a physical machine. So

1:08:41

if I understand correctly, right? So the

1:08:43

difference is with LLVM, you're

1:08:46

going to this immediate representation,

1:08:48

but then you're instantly going to

1:08:51

machine code. And

1:08:55

so now you have machine code that

1:08:58

can only run on that architecture.

1:09:01

But with Java, you're

1:09:03

still going to this intermediate format, but

1:09:06

you're not doing that second step to

1:09:08

go to machine code at

1:09:10

compile time, you're doing it at runtime.

1:09:13

Yeah, so the intermediate representation is

1:09:15

not really executed, right? There's no

1:09:17

program, well, again, you could

1:09:20

write one, but the intention isn't that

1:09:22

there's a program that runs the intermediate

1:09:25

representation. There is a

1:09:27

program, the JVM, that runs your

1:09:29

JVM byte code. Got

1:09:33

it. Okay, so

1:09:35

then now we get to sort of

1:09:37

scripting. And scripting and

1:09:40

interpreters, the idea is

1:09:42

sort of similar, it's very rhyming,

1:09:45

which basic was this way, other

1:09:47

things are this way. And that

1:09:49

is rather than a compiler, you're

1:09:52

running a program that

1:09:54

needs to work per

1:09:56

architecture, but that program is

1:09:58

doing all of the... work at

1:10:00

runtime of executing your script.

1:10:03

So it's converting

1:10:05

the symbols you wrote into

1:10:09

the letters you wrote into symbols. It's

1:10:11

building whatever it needs to

1:10:13

be able to execute it. So if you're

1:10:15

setting a variable name like Jason was mentioning,

1:10:17

it's keeping track of that. But it's doing

1:10:19

it sort of fresh every run. And so

1:10:21

it's opening it up. And if you have,

1:10:23

as an example, you know, a

1:10:25

typo halfway down, you're going to find

1:10:28

out about it out about it, a

1:10:30

down your program's execution or whatever. And

1:10:32

so it's not attempting to in this

1:10:34

sort of level

1:10:36

zero, it's not attempting to do anything other than

1:10:38

just sort of execute your script, right. So if

1:10:40

you've ever written Python, and you have a, you

1:10:42

know, typo at the bottom of your program, and

1:10:44

your whole program runs, and it doesn't output, you

1:10:46

know, the answer because it crashes at the end,

1:10:48

this is happening, it's not trying to compile,

1:10:51

it's not trying to look ahead, it's just there

1:10:53

is the program that's running on per

1:10:56

architecture is parsing

1:10:58

the script input at runtime.

1:11:02

Yeah, I mean, you can, this is

1:11:04

starting to really boggle my mind

1:11:06

that I'm thinking about it, like,

1:11:08

in Python, you can open the

1:11:10

interactive interpreter. And you can actually have,

1:11:12

you can write if statements and for loops

1:11:14

and anything you can write in Python, you

1:11:16

can write in there. And

1:11:18

so you can actually like write

1:11:21

a for loop in that for

1:11:23

loop have a break, if

1:11:26

a certain condition is met, and

1:11:28

then keep going. And so like,

1:11:30

Python has to kind of

1:11:32

remember that like you put that break

1:11:34

there, but it doesn't really know what's going to

1:11:37

happen after the break, because like you literally haven't

1:11:39

written it yet. And so

1:11:41

that's the kind of keep track of all of

1:11:43

these things while you're while it's interpreting what you're

1:11:45

writing. It's also not that

1:11:49

it's impossible other places, but it becomes much more

1:11:51

straightforward to things like Python

1:11:53

loves to do, which is like modified

1:11:55

definitions on the fly, right? So like

1:11:58

changing variable names to another. type

1:12:00

or to even modifying functions that

1:12:02

are on a class because all

1:12:05

those things are sort of held in memory,

1:12:07

right? Like the sort of processing,

1:12:10

the compilation goes into memory and is

1:12:12

just held and is done sort of

1:12:14

in real time like at execution. And

1:12:16

so modifying that stuff is more

1:12:20

obviously, you know, straightforward to implement.

1:12:23

It's not obvious, but you can kind of

1:12:25

envision how you would do that if it's

1:12:27

like a thing sitting in RAM versus if

1:12:29

you've compiled it into something that you admitted

1:12:31

to the disk, right? And you're sort of

1:12:33

executing out of read-only memory. And

1:12:35

again, there's lots of things that blur

1:12:37

these lines. But yeah, so scripting, when

1:12:41

people sort of think about it, it can be slower

1:12:43

because at runtime, you have to

1:12:45

do more, right? You have to convert the

1:12:48

mapping. You don't need

1:12:50

to know that, you know, your variable name

1:12:52

is some complex, you know, set of underscores.

1:12:55

When you're doing the compile, you just map it to, this

1:12:57

is the first variable I've seen. So it's

1:12:59

variable lookup table entry zero, right? It's literally

1:13:01

just a pointer or just an index zero.

1:13:04

And then every time you see that, you're keeping track

1:13:06

of it. But in the final program, it

1:13:09

all gets taken away, right? Because it's just everything

1:13:11

points to the right spot. And

1:13:13

all those things are resolved. When you're

1:13:15

doing scripting, though, when you're marching down the program,

1:13:18

that table has to live in memory. And you have to

1:13:20

go do that lookup, right? Jason's

1:13:23

most complicated, very long named, but

1:13:25

not meaningful variable, that has

1:13:27

to get parse, which is a lot of characters, and

1:13:30

has to get that mapping to take place

1:13:32

every time it seems sort of like at

1:13:34

runtime. And so this gets to why people

1:13:36

kind of say scripting would be slower. But

1:13:38

as Jason mentioned, the advantage is because execution

1:13:40

is happening at like, you know,

1:13:42

kind of while you're doing it, and all these

1:13:44

steps are you can also modify the steps. And

1:13:46

it becomes very easy to do and to interactive

1:13:48

and to kind of see what's happening. And,

1:13:51

you know, very straightforward. Yeah,

1:13:53

that makes sense. I believe

1:13:56

if you your

1:13:59

machine code. is loaded

1:14:02

into the process memory that you

1:14:04

can't touch. If

1:14:06

you start writing in

1:14:08

the chunk of memory where your machine

1:14:10

code went, they'll

1:14:13

assume that you're trying to do something nefarious

1:14:15

or something or a mistake, but

1:14:18

in Python there's probably no way to catch that. A

1:14:21

lot of early viruses did this

1:14:23

self-modifying code. So people screen

1:14:25

them, they look normal, but then they get modified to

1:14:27

do something that is nefarious

1:14:30

at execution. Yeah,

1:14:32

a lot of people, a lot of systems will

1:14:34

try to stop or prevent that and assume that

1:14:36

you were making a mistake and at best preventing

1:14:39

you from doing something you really weren't supposed to

1:14:41

do. Yeah, that

1:14:43

makes sense. But yeah, that's mind-bendy stuff when you

1:14:45

start talking about that. Okay, two couple

1:14:47

other things I wanted to cover briefly. You'll

1:14:49

hear about, so one is a JIT, which

1:14:52

is just in time. So for scripting languages,

1:14:54

all is not lost about these runtimes. So

1:14:56

in Python as an example or other things,

1:14:58

you can have a JIT,

1:15:00

which says, hey, I've noticed

1:15:03

that this piece of script

1:15:05

has been executed, this function has been called

1:15:07

many, many, many times. So I'm going to,

1:15:09

rather than every time I get to it,

1:15:12

do all the parsing and all the work

1:15:14

again, it can effectively do a compilation step.

1:15:16

It can go ahead and resolve all of

1:15:18

those things, it could even go could do,

1:15:21

implementing them all the way out to machine code or

1:15:23

to operations or whatever, right? Java

1:15:25

has this as well for byte code,

1:15:28

but basically at runtime, sort of observing

1:15:30

that you're about to do something or

1:15:32

that you've done it before and

1:15:35

pre-computing and storing those results so that the

1:15:37

next time you do it, you

1:15:39

get your execution. That's sort of the

1:15:41

concept, I'm probably doing a bad job,

1:15:43

but of just in time, right? It's

1:15:45

just in the nick of time, I've

1:15:47

provided you a optimized thing to run.

1:15:50

Right, and you can do the loop unrolling and

1:15:53

all of that stuff. If you know that this

1:15:55

for loop's only been executed four times or

1:15:57

you don't know it, but you're confident, then

1:16:00

you could unroll it. Yep. And

1:16:03

you could even do code analysis to

1:16:05

do it right again, that you know,

1:16:08

extend these all have like research directions

1:16:10

or implementations and various, you know, features.

1:16:12

And then the last thing I want to talk about

1:16:14

that also blurs the line though, is something

1:16:16

that's actually interesting you've ever seen it, which

1:16:19

is profile guided optimization. So some

1:16:22

of these drag races, I guess you

1:16:24

call them between sort of scripting languages

1:16:27

and compile languages will show, Hey, actually

1:16:29

this Python code is a lot faster

1:16:31

because in this case, the, you know,

1:16:33

during runtime, Python, the interpreter observed

1:16:35

these behaviors and perform this optimization

1:16:37

that you couldn't have known a

1:16:39

priori, it had to be known

1:16:41

sort of like at runtime and

1:16:44

it gains this advantage. It's

1:16:46

true. That can happen. That is a thing. And

1:16:49

it can be really cool. In compiled languages,

1:16:52

we're starting to see some work

1:16:54

around profile guided optimization, which is

1:16:56

run your program and

1:16:58

you record a bunch of statistics about

1:17:00

what, what, how many times various loops

1:17:02

by default was this if statement skipped

1:17:05

99% of the time and even compilers

1:17:07

do some of this, sorry, even processors

1:17:09

do some of this to help with

1:17:11

optimization, but sort of recording statistics about

1:17:13

what was executed, how much and various

1:17:15

sort of things. And, and that the sort

1:17:17

of call it happy path, you make a guess, I'm

1:17:20

just going to assume this is going to be true

1:17:22

and I'll add a little check. If

1:17:24

it's true, I'm going to gain this boost. And

1:17:26

if it's not true, then I'll have to execute something

1:17:28

a little slower, right? No free lunch. But

1:17:31

it does this via a profiling. So

1:17:33

you've profiled your code. And now this

1:17:35

optimization uses that profile of the code

1:17:37

as a sort of almost second compilation.

1:17:39

So you run the compilation, you insert

1:17:41

all these sort of like, you know,

1:17:44

extra hooks to measure stuff. You

1:17:47

look at the output and then you run compiling again,

1:17:49

that uses that as

1:17:51

input and it's able to sort of

1:17:53

be more thoughtful about how to perform

1:17:56

certain optimization steps of compiling. Also

1:18:00

if people are really excited about

1:18:03

compilers and interpreters and

1:18:05

they want to work on the. I

1:18:08

thought of the mr the c++

1:18:10

like gcc or something where

1:18:12

does most of that work take place but

1:18:14

i guess the pilot government. Programs

1:18:16

and giant companies and stuff like what

1:18:18

would be your career advice so

1:18:21

there are folks working up you know big

1:18:23

company big tech companies that you sort of

1:18:25

here right if we if we sort of

1:18:27

name some you know dark you know i

1:18:30

google or swift at apple or i think

1:18:33

java is still at oracle you know

1:18:35

obviously those places have teams that work

1:18:37

on these things and you can go

1:18:40

work on them. But

1:18:42

I think a lot of it also happens

1:18:44

as a hobbyist do stuff you

1:18:47

know in university, this

1:18:49

is compilers and interpreters is,

1:18:51

of course, you can take. If

1:18:54

you want to do it as a job. What

1:18:57

I don't know is like how you as a

1:18:59

job without working at a big company that has

1:19:01

a vested interest in it you sort of get

1:19:03

paid to make a very cool. lvm

1:19:06

and intermediate representation optimization definitely

1:19:09

something you can do. And

1:19:11

if you have a company that will sponsor their work which is you

1:19:13

know maybe a hard thing to find i don't

1:19:16

know that it's not like writing a game we just do it and

1:19:18

then people pay you for a good outfit.

1:19:20

Very difficult to write like a new

1:19:22

language that someone would pay

1:19:24

you just to like consult on my

1:19:28

opinion maybe i'm wrong. Yeah

1:19:31

i think you're right i think even if if

1:19:33

you set out to create a

1:19:35

new language i think

1:19:38

even then i would probably start by.

1:19:41

Working for one of these big companies i think like

1:19:44

i want to say. What

1:19:47

is the military labs is like the.

1:19:50

Keep person on gcc like send you

1:19:52

are one of these labs i don't

1:19:54

remember but basically you know for all

1:19:56

of these things lvms

1:19:58

with gcc. You know,

1:20:01

look at who their biggest sponsors

1:20:03

are, right? Look at

1:20:05

who the domain

1:20:07

name of the email addresses that are

1:20:09

most prevalent on the mailing list, right?

1:20:12

It's not hard to figure out who

1:20:14

is actually putting in most,

1:20:17

you know, of the effort for

1:20:20

that particular compiler or interpreter. And

1:20:22

then once you know that,

1:20:24

then it's a matter of, you

1:20:27

know, creating changes. You

1:20:29

know, basically doing that job kind of

1:20:31

pro bono for a little while and

1:20:33

proving yourself to those folks, you

1:20:36

know, becoming ingratiated by those

1:20:39

folks and then reaching out to them and saying, hey, I

1:20:41

want to do this full time. And

1:20:43

so if that's something that interests you, that's the path for

1:20:46

it to do that. You don't need to be a

1:20:48

master propagandist or anything like

1:20:51

that. It's a very simple formula.

1:20:54

Just put some sweat equity

1:20:56

into that. You

1:20:58

know, talk to the folks who are also putting

1:21:01

in that sweat equity. I'll

1:21:04

give two shout outs quickly, you

1:21:07

know, for I don't think this is the first

1:21:09

thing you do, right? Write programs for a while

1:21:11

before attempting to write your own programming language. Right.

1:21:14

Probably a good move. But two resources

1:21:16

that I think are really

1:21:19

useful here, many more, but, you know,

1:21:21

people would have recommended the Dragon compiler book

1:21:24

before, but I never made it through it.

1:21:27

Anyways, the first one is by, and

1:21:29

I might not say the last name

1:21:32

correctly, but Robert Neistrum, Neistrum, and he

1:21:34

wrote a game design pattern, like design

1:21:36

patterns for games that's very useful. Definitely

1:21:39

check that out. I think you can read it

1:21:41

free online, but also read free online crafting interpreters.

1:21:44

So craftinginterpreters.com. I

1:21:46

think there's a web version, but I think there's actually a

1:21:49

physical book as well. And I

1:21:51

haven't sort of gone through it and implemented it myself.

1:21:53

It's on my to-do list. But definitely

1:21:55

a way of talking about how

1:21:57

would you add an interpreter, implement Polymer?

1:22:00

How would you handle variables and sort of building

1:22:02

up your own programming language and sort of, you

1:22:05

know, not going to be, I don't think state

1:22:07

of the art, you know, pushing the envelope, but

1:22:10

definitely giving you a flavor for this, which I

1:22:12

think is really useful to know how some of

1:22:14

this stuff works. And then in

1:22:17

the sort of opposite side of that, I

1:22:19

mentioned it, but nandgame.com. There's

1:22:22

also NANDtetetris, but nandgame.com is really easy

1:22:24

to jump in and start showing you,

1:22:26

like, one

1:22:29

touch too low, maybe, for what we talked about

1:22:32

today, where how do you build a NANDgate? How

1:22:34

do you make an OR gate from a NANDgate?

1:22:36

But quickly jumps in, basically, how do you build,

1:22:39

you know, the actual

1:22:41

processor components, the

1:22:44

parts that do math? How do

1:22:46

the bits get added? And why

1:22:48

is it that a certain machine

1:22:50

code byte evokes a certain behavior

1:22:54

from the pieces of the computer, the actual silicon? Anyways, and

1:22:56

so you can just, like, play it in your web browser

1:22:58

and, you know, just sort of go at it. You might

1:23:00

have to Google some help. I did. Sorry.

1:23:03

But, you know, how do you implement registers? How do address

1:23:05

buses work? Anyways, that's nandgame.com open

1:23:07

up both in the show notes, but two

1:23:09

useful resources. There's a modern

1:23:12

take on this game too called

1:23:14

Turing Complete. Oh, I didn't

1:23:16

want to pitch it because I haven't tried it. I

1:23:18

haven't tried it either. So I

1:23:20

haven't tried NANDtetris either, but it

1:23:23

has amazing reviews. I just

1:23:25

looked it up. It's overwhelmingly

1:23:28

positive. Steve reviews,

1:23:30

2,200 reviews. So

1:23:33

that is a really good endorsement

1:23:35

by the community. Yeah, I've heard

1:23:37

a lot of people say it's another good resource, so I'll put

1:23:40

it in the show notes too. Cool.

1:23:43

All right. Thank you, Patrick, for

1:23:45

going into a ton of detail

1:23:47

here. This is an awesome episode.

1:23:49

Thank you, Jessica, for recommending the

1:23:52

topic, phenomenal topic. And

1:23:55

thank you to all of our

1:23:57

patrons who are kind of supporting

1:23:59

the show. No helping us reach

1:24:01

new people and. I. Was

1:24:03

looking through my email the other day

1:24:05

about something kind of unrelated and I

1:24:08

stumbled upon a. Email. From

1:24:10

a listener. I'm. A.

1:24:12

While back, who are who we are able

1:24:14

to help them. You'll find their first job.

1:24:16

I mean that's it's really inspiring to Jesus

1:24:18

and that to us. We read all of

1:24:20

them such as read him twice and does

1:24:22

he find him years later? read of again,

1:24:25

On So thank you everybody out

1:24:27

there for listening for supporting the

1:24:29

south and and we'll see you

1:24:31

next time. I

1:24:45

know. More. Forgiving.

1:24:48

Third Down is distributed under a

1:24:50

Creative Commons. Attributes Sarah like to

1:24:53

point out allies: You're free to

1:24:55

share copy to services with the

1:24:57

work. The Remix adapt the work

1:24:59

but you must provide attributes and.

1:25:03

I and I sarah in

1:25:06

time.

Rate

Join Podchaser to...

  • Rate podcasts and episodes
  • Follow podcasts and creators
  • Create podcast and episode lists
  • & much more

Episode Tags

Do you host or manage this podcast?
Claim and edit this page to your liking.
,

Unlock more with Podchaser Pro

  • Audience Insights
  • Contact Information
  • Demographics
  • Charts
  • Sponsor History
  • and More!
Pro Features