Luke 19 verse 1 then Jesus entered and passed through Jericho now behold there was a man named Zacchaeus who was a chief tax collector and he was rich and he sought to see who Jesus was but could not because of the crowd for he was of short stature so he ran ahead and climbed up into a sycamore tree to see him for he was going to pass away excuse me and when Jesus came to that place he looked up and saw him and said to him Zacchaeus make haste come down for today I must stay at your house so he made haste and came down and received him joyfully but when he's when they saw it the crowd saw it they all complained saying he he has gone to be a guest with a man who is a sinner then Zacchaeus stood and said to Lord Lord look Lord I give half of my goods to the poor and if I have taken anything from anyone by false accusation I restore them fourfold and today and Jesus said today salvation has come to this house so I'm saying amen amen so I want to split the sermon into three into three categories the three or three part segments of of the sermon in the first segment I want to talk about is trying Zacchaeus was trying to see Jesus he he lived a bad life he was a everyone knew him as a bad person he was rich it wasn't because he was rich but the way that he got rich was in very bad bad ways ripped people off cheated people and he was just living a bad life and but and still in that Zacchaeus still wanted to see Jesus and I believe I believe that that speaks for everyone here is no matter who it is if you're atheists if you Catholic if you're a Buddhist if you're Muslim what whoever you are if there is a God out there that you deep inside you have a craving to know this God there you have a craving to experience this God and that's exactly what Zacchaeus was he he was a bad person but he still craved to see Jesus and when Jesus was passing by the Bible says he could not see the crowd but he could not see Jesus because of the crowd but we both know it wasn't the crowd that was the reason that he couldn't see Jesus the real reason the Bible says one verse later is is because he was a short stature and see something Zacchaeus and I have in common you and I Zacchaeus have in common is we all are short the Bible says in Romans 3 23 we all have sin and fall short of the glory of God so we have something in common and all your short people in the house it's not your fault you weren't you were born short no I mean you didn't be I mean you were born short you didn't become short like hey no you're in the womb and you like selected your characters in the womb short medium size of blonde hair no you didn't you were just born short and so we we are born short of reaching the glory of God from the set from the get-go we were we were never gonna be able to reach God's standard to achieve the standard of God and God knew then so but a lot of times when we're in there we we like to put excuses and we say well the reason I don't I can't reach God is because of the crowd is because of Christians no I met a Christian Christians are hypocrites and Christians say that they're this and Christians are Christians are hypocrites and that's why I don't want to go to church well Walmart has hypocrites but we still shop there yeah Jim has Jim Jim has overweight people thank you Jacob we said Jacob we'll pray for you but Jim has overweight people but we still go there yeah amen at those that go Jim the hospital has sick people well yet when you get sick where do you go you go to the hospital so the crowd wasn't really the issue of why we could not see Jesus it was because we are short we all fall short of the glory of God we all fall short of what what we can reach God we can it's not by our our deeds it's not by our accomplishments of what we can do to reach God we can't and but the thing was Satan what Satan will do is face Satan will offer a counterfeit it Satan will offer a false safety that in that you will follow the crowd you will be in the crowd that follows Jesus as long as you don't get to know Jesus hmm he will let you come to church every Sunday the kids love it in the kids own worship good vibes really good I like the drummer the kids own is really good the music is really good I get you get really just tears and Jesus is so good and and and he will offer that he will let that if he knows he can't stop you from going to church he will let he'll give you a counterfeit a false safety that that you can follow Jesus as long as you don't get to know Jesus because there was a lot of people that were following Jesus but he never got to know Jesus they never they never experienced Jesus amen and it's just like I don't know if any of you have flown somewhere on an airplane you can get to get to the airport and then no when you've ever I've missed a plane once no you're in the airport but you get to that place you're in the airport and you get to the place and your the gates are shut and the plane is taken off you got to the airport but you missed the airplane see the purpose of the airport is not to be in the airport the purpose of the airport is to get to the plane the purpose of church is to get to Christ the purpose of Sunday is to begin to get to know Jesus is to begin to experience him the thing is you and I we're short we can't do we can't do our deeds can't measure up to be into reach God's standard we can't begin to be to try super hard and the thing is the kids was trying that maybe you're in today you're like the kids you're trying to get to know Jesus you're trying to get better that's why we have the self help books that's why we go to the gym to to get better to look better we try but yet we all fall short of the glory of God if I can encourage you something I'm gonna encourage you don't settle for joining in the good for joining the crowd and your attempt of finding Jesus don't settle for just coming on Sunday Sunday church Wednesday church Thursday church and and getting the good feeling by yet going back to your lives that's broken shattered busted and disgusted don't settle for that and what I love about the purpose for church is is to reach Christ the purpose for the airport is to reach the plane to reach your destiny to reach what God has in soul for you the Bible says I know the plans that I have for you there for good and for not we're not for evil to give you a future and the hope says God amen and that is the purpose of church is not to come and get a feel good Sunday and get a check mark and I'm going to heaven churches and life isn't just about salvation so we see the key is is trying really hard he's trying and his attempt to reach Jesus fails and he gets really discouraged he gets really sad like man I can't see Jesus it's the crowd's fault but the thing is the key is doesn't stop there he doesn't settle just to be in the crowd knowing his his bad knowing his wrong he doesn't settle just to be in the crowd what's the key is this so he's trying what's the key is does after that as he's fine oh look there's a tree perfect Jesus is gonna be walking by here in like five minutes so he gets and he climbs onto the tree and what I love about this is is when Jesus when Zacchaeus climbs onto this tree the Bible says Jesus looked up and saw him and said Zacchaeus when Zacchaeus climbed on that tree it wasn't Zacchaeus that saw Jesus it was Jesus that saw Zacchaeus can I tell you about a tree that was planted 2,000 years ago the cross of Calvary that me and you trying so hard trying to be good at for all the short people like you and I that fall short constantly on a daily basis no matter how hard we try for you and I I'm gonna tell you there's a tree that was planted 2,000 years ago that if you climb on that tree not only you will see God not only you will see Christ but Jesus will see you Jesus will see the blood that was shed for you God will see the price that was paid for you one guy when people say that you don't deserve it that you couldn't earn it God says I don't see that when I see you climb onto the tree I see one thing and one thing only I see my son and something that happens there's Jesus calls him by his name Zacchaeus I want to I want you to see what the original language says about Zacchaeus says he is pure and innocent tax collector that robbed people cheated people lied to people did so many things yet Jesus called him by his name I'm gonna tell you something Satan knows your name Satan knows your destiny Satan knows your worth Satan knows who you are destined to be yet will call you by your sin but what I love about our father what I love about Jesus is Jesus knowing your sin knowing what you did last night still calls you by your name still calls you by who he says you are still calls you a son still calls your daughter still calls you wonderfully and beautifully made he says son and daughter I know who you I know the sins that you did but the thing is I put your sin as far from the east is to the west when I see you and you climb on that tree I don't see you I see the Sun see and that's what we're trying to accomplish through this series embrace grace is we want to challenge you that in the midst of your mistakes and your failures in your in your in your troubles that you can climb onto the tree that you can climb onto the cross and hug the cross and hug the cross and say God I'm I embrace your grace I embrace God the salvation that you've given me I couldn't earn it God I couldn't deserve it God but it's your love that you have for me embrace grace Jesus sees you religion says try harder Jesus says trust religion religion's gonna make you jump see Jesus Jesus where you're Jesus Jesus right there he's gonna let you the religion let you have a glimpse of Jesus but a relationship with Jesus let you have a gaze of Jesus every day it's a communion with Jesus every day it's it's when you climb onto that tree not only you see God but God sees you God sees your issue God sees a broken home God sees a broken marriage God sees a broken family God sees the education that's fairly God sees the sickness that you have and says the key is I see you come down religion is you trying to see God gospel is trusting Jesus the only way to God is through Jesus it's not a good deeds it's not our what we can do it's not what we can accomplish some people are like man this is slapping the face what about all those years that I've done good what all those orphanages that I came God bless you God will in heaven he will reward you maybe even on earth you reward you all those years that I didn't smoke like Passover I says God didn't put a chimney on your head for you to smoke so don't smoke it's good for your lungs you know I mean oh I went to prayer everything that's good that's for that's for your own benefit I fasted that's for your own good health your relationship with Christ but it's not our good deeds that gets us to heaven the Bible says there's only one way to heaven that is Jesus yeah because if it's if we're gonna go by the way where it's my good deeds Jesus wouldn't Jesus didn't die on the cross for you to see how much Jesus can suffer you think God sent his son to show you look look how much my son could get beat no he showed you so that there's a way for salvation that he can show you how much he loves you not to show how much he can suffer if it was just that it'll be something else there's only one way to God that's through Jesus because if it's gonna go through our good deeds this fits gonna go through the way I can get through to Jesus because of all the good that I did we got a look on the opposite side what about one sin that you commit what about the one the one fault that you commit what are you gonna do say oh God don't don't look at that one look at all the good but just don't look at the God don't look at that one if I if I give you a cup of if I give you a cup of water it's all good just freshly open if I give you this and say it's perfectly fine I take a drink out of it but I put one drop of poison in it just one it's a man it's a big cup of water whole bunch of good but if I put one drop of poison in there and say take a drink it's just a bunch of good and one bad really no try to kill me no but it's just one drop all it takes is one sin for you to be condemned see when you when I used to think when I know I get a ticket no it'd be all the good no the justice no the justice killed uh I know in the school yeah the justice kill I used to think that it was it was whole bunch of all your good versus all your bad that's how it's gonna be measured but until you get your first ticket and you realize it's not all that it's not all your good years of driving versus your one ticket no it's your one ticket versus perfection versus the law but the thing is Jesus knew that God knew that that it's not it's not my good deeds because all it takes is one fault and the scale tips and I'm going straight to hell Jesus God God knew that so what he did is he sent his son to die on the cross for you and I so that the Bible the Paul says it's no longer I but Christ in me that when I step on the scale it's not I that steps on a scale it's Jesus that's perfect it's Jesus that's sinless that took my sins on the cross he steps on the scale all of a sudden it starts to even out I'm gonna tell you a story of a tribe leader maybe you guys have heard it before but there was a tribe leader and he he made up the whole bunch of yeah he had his tribe his village and he made up a whole bunch of rules he made about a hundred rules no if you create this if don't defraud don't do this don't do that don't do this don't do that because if you do it does a whole bunch of rules if you do you get a hundred lashes everyone's like ooh that's bad so everyone in the first couple days everyone was like okay I'm not gonna create I'm not gonna do any bad cuz no one wants to get beat you know I mean good old days of getting beat so no one wants to get beat and and then all the sudden couple about a week later there's this one kid that that stole something and piece of gum or something something small and everyone gathers around and lo and behold it's a tribe leader son and everyone gets around like what's gonna happen is is the tribe leader is gonna let him go because his son he's is he gonna know you can't beat his son maybe what kind of a father would he be you know that's your son he's gonna die for a piece of gum really but but on the other then other side if he doesn't what is he gonna give him a free pass just because it's a son just because it's someone that he loves he's gonna give his son a free pass and everyone gathers around because they're like man is this is he gonna play favorites with his son or is he gonna beat his son what kind of father would he be so everyone gathers around and and they gather around and they they will look what's gonna happen tribe leader says yes I'm gonna my son and deserve the punishment and he's gonna get the punishment so they take off the shirt off his son and they strap his son to a pole and they're about to beat him but right before they beat him the father says hold up and he takes off his shirt covers the back of his son and says now you can now you can begin so that he upheld the law but showed love to his son see if God did not let Jesus die on us on the cross for you and I for our sins he would me and you would go straight to hell because God's holiness demanded a price to be paid God's love provided a son God's holiness demanded a price to be paid God's love gave the price gave the payment God's love gave the son to Don the cross for us for me and you that's why we can't boast about our deeds that's why we can't boast about what we can do it's only through a relationship through Christ that we can get to heaven it's only through a relationship through Christ that we can get to to the father relationship can't be based off your good deeds relationship with Christ cannot be based off what good that you've done what good that you've accomplished in your life it only can be based off trust before the foot with the father it can only be based off getting on to that tree embracing grace embracing the love that the father have given us amen trusting brings salvation so I want you to see it there's trying where Zacchaeus tries and he he tried to do good and yet he failed and then there's trusting and today just like no the airport in the plane if you're in the airport we're gonna give a call today loud and clear that if in your if you're in the airport that you don't miss the plane that the purpose of being in the airport is not about the airport but it's about getting on the plane it's about reaching Christ amen it's not about church it's about Jesus trying trusting and then there's a third part and I think it's the most important that's what I want to really focus on it's about transformation Jesus when Jesus saw Zacchaeus he looked at Zacchaeus and he said Zacchaeus make haste come down I must go to your house as a case is like we say like my house you sure like like right now my house or like like can you say Jesus can you give me five minutes my girlfriend is in my house I gotta tell her dip real quick there's there's something in in in my fridge that you're probably not gonna like let I'm gonna have my friends just throw it out real quick hold up my room is a whole bunch of mess so bunch of underwear socks I'm gonna have them cleaner okay just give me five man Jesus I wasn't expecting you to come to my house but see what what happens a lot of times when we come here to the front is Jesus Jesus doesn't want to be left at church this Sunday to the next Jesus says and how will work for you now I must go to your house I know the mess that you have and the thing is when Zacchaeus got down people laughed at him people said do you know who he is he still does drugs do you know the life that he lives it's terrible it's shattered do you know the marriage that they have Lord of Jesus it's on the fourth one already do you know the kind of life that they're living but he doesn't pay attention to that knowing that she doesn't deserve Jesus at his house he still got up and said all right well we're going to our house he's gonna see it this today is the day and he went he went to the house and I believe this is where transformation begins I believe accepting Jesus here at the altar is where salvation begins but I believe Jesus didn't just come for salvation but he came to transform your life he came to begin to today he says son daughter I want you I want to go home with you I want to take you by the hand and go to the messy the life that you have I want to take your hand I want to go to the broken marriage that you have the broken relationship without the broken finances that you have the broken family that you have stickiness I want to go to your house and he's asking you to say yes to that call he's asking you to say yes to that call don't just leave Jesus at the altar Sunday after Sunday take Jesus home with you and maybe you're saying but I don't deserve it the kids didn't deserve it either but it's the fact of getting onto the cross and saying this is not something I deserve but God thank you God this is not something I could even earn or work for but thank you I accept it I say yes to your call I say yes to taking you home with me overcome what people have to say about your life what people know maybe you have a reputation of this person when when people see people will call you by your name but Jesus is called people will call you by your sin but Jesus is calling you today by your name saying Joseph Isaac I want to go home with you Mary I want to go home with you I know your life is broken it's exactly why I want to be at your home and the keys begin to overcome what people said Christianity is the only relationship only religion every other religion says you have to reach God you have to do to do you have to try to reach God you have to do this to to reach God you have to do you have to sacrifice your life you have to sacrifice your son you have to do this to reach God Christianity's the only religion said that says God wants to reach you and he's saying to trust him what I love about the story of Zaccheus when he takes Jesus home is when he takes when he takes Jesus home Jesus doesn't come to Zaccheus's house and he says all right things have got about a change you move that over there alcohol has to go out of the fridge your girlfriend has to go or get married doing one of those this thing has to go those magazines has to go that computer has to go that's not doing no good that so go you got to start tithing Jesus International start tithing every 10 percent make up all those mothers that you stole from and you ripped off and they're struggling you got to give back four full you got to start doing that you got to start doing it come on Zaccheus you can't be sleeping or you can't be doing that he doesn't do anything all he is is he's in the house and simply God's presence in the house Zaccheus says all right Jesus so I'm gonna start giving back to the to the mothers I'm gonna start giving every person that I ripped off I'm gonna start giving back four-fold and Jesus says now salvation has come to this house the presence of Jesus simply the presence of Jesus begins to transform the atmosphere simply the presence of Jesus begins to transform your life you'll never be the same after a touch of Jesus after you experience Jesus he says son daughter I want to go to your house I want to go to your house to your relationship take me home with you take me home with you I'm gonna ask that you say yes to the call that you say yes to Jesus that you stop trying to live the good life that you're living drop stop trying to go by your own deeds your own good your own your own thing cuz you will burn out you will you will start sliding back you it just won't be good the Bible doesn't say by your good deeds the Bible says not by might not by power but by the Spirit it's only by the Holy Spirit's guidance by the relationship with him if I could propose a theory or idea to you that when you accept Jesus when you take Jesus home to stop working on yourself constantly might sound like a little bit of heresy but stick with me a couple moments it might sound like it's what it means stop working on my character stop stop what happened is Zacchaeus was there his life was bad his life his character his the light that he lived was terrible but the moment that Jesus came into his house he began to change the the simple fact of God's presence living inside of you day by day begins to change and and the moment you stop focusing on your character on the good deeds and and trying to do it all yourself and you focus on the presence you focus on the presence of God in your life what begins to happen is through relationship with Christ taking Jesus home fruits of the Holy Spirit begin to manifest and fruits of the Holy Spirit is Christian character kindness goodness peace patience self-control gentleness a faithfulness all this this is this is all fruits of the Holy Spirit and you when you stop focusing and you ship your perspective your view on to Jesus on to trusting Jesus climbing on to that tree and taking Jesus home to your messy life to your messy situation to your messy marriage and you start focusing on a relationship with him a communion with him coming to morning prayer Friday to Monday through Friday beginning to fast Monday through Wednesday with us when you begin to focus on a relationship with him he begins to work on your character he begins to bring the fruits of the Holy Spirit he said you were struggling with anger here's here's kindness here's his gentleness and he begins to work on you begin to shift your your focus on on your character on trying to do good to trusting Jesus from trying trying to do good to to climbing on that tree and just grabbing on to Jesus and say Jesus I can't do it on my own Jesus I can't I can't manage on on my own it's not it's not I can't do any good I've tried but I'm messed up I'm in the same messed up place that I am was years ago to coming down the tree and say Jesus I want to have a relationship with you I want to begin and I believe that's where Holy Spirit begins to work on you he begins to work on your life your character your your your things that you need and he begins to mend the broken hearts he begins to mend the families is when you begin to take Jesus home hey this is Pastor Vlad and thank you for watching this sermon please click on the subscribe so that you can be a part of our hungry generation YouTube community and click on the bell as well so that you can be notified when we upload the new sermon thank you for watching and God bless you


Going on everyone Sam here with late sports cards. We're in at 23 tops gilda collection baseball hobby six box case number 44 Pick your team style read off a list of our names on our teams Andrew a mariners Andrew are with the Red Sox Austin L Twins Guardian shipe with the rays Brian O Tigers Francis H. Phillies Gavin K. Astros Greg M Nationals James J Royals Jeremy S Cardinals Joshua B Brewers athletics Cubs Kevin M angels Yankees Giants Kevin as well as Kevin M with the Orioles Mets Kevin G with the Braves Kim C Pirates Dodgers mark S Marlins Paul B Padres and Rangers Sodonoree Y Rocky Scott F white Sox Todd W reds van L diamond bags and Wayne P with the Blue Jays Good luck here everybody again 21 to go and flux all teams mark down in flux 21 to go and flux they are all marked down as well everybody. All right, let's get going on gilded here. Good luck Yeah, I guess that's valid Yeah, for sure Jordan Groeschans 275 for the Marlins Congrats, Miami. Very nice. Got a Joe Morgan to 99 Going to the Reds. Got this one next one into a mag for sure. It's gonna be 250 We've got Corbin Carroll five of 50 on the mini diamonds gold. Congrats the diamond bags There you go, Arizona very nice 299 is Justin Steele for the Cubs. Congrats, Chicago Nice one going to Chicago the white Sox 3 of 25 Carlton Fisk on the frame, daughter I've said that before and yeah, it kind of does Hey, nice. There you go, Joshua Hell yeah, yeah, Joshua at the Cubs. Steele's nice, too. Steele's a beast Steele's a beast Love seeing it I think everybody likes seeing that To 75 O'Neill Cruz Kind of look like Carlton Fisk I guess so Yeah, it's Gabby Moreno. Nice one there to 99 for the D-becks Alvin with Colorado in 18. Thank you Alvin. Sean P picking up the magic in 17. We're down to 20 Thank you Alvin and Sean Got Edward Julian to 199 That is going to the twins on the etched in gold rookie Very nice. Scott to 50 is Lenin Sosa 33 of 50 Lenin Sosa For the white Sox and then going to the Royals 81 of 99 Vinnie Pasquantino Vinnie Pasquantino At the U.S. with the Guardians in dual case. Very nice. Very nice Then down to 20 to go almost into the teens everybody 20 to go 20 to go On flux got nice. That is 250 Oswald Paraza framed a rookie oughta Congrats Yanks Very nice. Very nice. I almost threw it away All right, we got it. We got it 20 to go all on sale Jazz chiseled to 75 for the Marlins got a Lou Gehrig 80 of 99 for the Yanks Iron Horse 80 of 99 Got again to 99 for the Yanks is 30 of 50 Mariano Rivera the Sandman Chess And 33 of 50 Nolan Jones going to the Rocks. Congrats, Colorado. Actually Rocktober is right. Yes, sir Nice one here to 50 Jim Cot Congrats on that one twins Jim Cot Going to Minnesota Hall of Fame hit right there x-break our next box I should say Nice jazz pull. Oh, that's right. Your daughter doesn't your daughter collect jazz chisel mark. I forgot about that. Yeah, there you go Oh, yeah, a freddy freeman 75 for the Dodgers Michael Harris to 99 one of 99 rookie for the Braves Gratz Braavos got Mookie Betts to 50 Nice one there for the Dodgers And to 75 Garrett Mitchell. Congrats on that one their brew crew Going to the Braves Tom Glavin 11 of 50 on the framed hit. Congrats there Atlanta That's pretty cool. Metta been midland. We play for the D-backs.  That wasn't really young just free trade just Talk about a trade that talk about a win-win gallon and gallon for jazz basically 22 go on flux everyone All marked down All marked down Jay called it fluck accidentally put 20 to go in or whatever to go and fluck like nice dude Boxes There's masatake Yoshida to 75 I know just typed in fluix. That's why I said That's why that's why I tried to shift that away onto jake Because I know I missed messed up on that one two 99 Jackie Robinson for the Dodgers Congrats la 64 of 99 Jack Minidiamonds for the Mets that is going to be 34 of 50 mark of the Entos Nice rookie there for the Mets and then to 75 Tyler Freeman going to the Guardians rookie autograph Congrats there Guardians 23 of 50 Frank Thomas Nice one there the big hurt on the framed hit For the White Sox Call myself I like to see Ricky Henderson to 75 for the A's Congrats there Oakland Todai Senga 74 of 99 for the Mets this is cool Raywave going to the Yankees Derek Jeter 7 to 25 El Capitan Congrats on that one there Yankees Derek Jeter And 53 of 99 Logan Ohapi going to the Angels. Congrats on that rookie autumn Logan Ohapi all right last pack of the break here everybody Oh, that's sick for the Yankees Godzilla Hideki Matsui 7 of 25 Your defense was brutal Spencer Nice one there Congrats Yankees very nice Love Hideki Matsui quick recap here We had Edward Julian Kodai Senga Jackie Robinson Michael Harris Gabriel Moreno Lou Gehrig Joe Morgan O'Neil Cruz Jazz Chisholm Freddy Freeman Ricky Henderson Masatake Yoshida Jordan Groeschans Mariano Mark Vientos Mookie Betz Derek Jeter Logan Ohapi Vinny Pascantino Justin Steele Tyler Freeman Garrett Mitchell Lennon Sosa Nolan Jones Some frames we had Frank Thomas Tom Glavin Jim Cot Oswald Brazza Carlton Fisk Kadecky Matsui And Corbin Carroll to 50 on the Minidonics I'll do it for the break everybody. Thanks again for the film. Up next is Flux


Now, we'll have a conversation about that tonight. Yeah, I don't know why he's waiting till tomorrow. So what do you train your emotion about this? What are you saying? It's unacceptable. It's just unacceptable. It shows disrespect to your ball club. Everybody that comes in that locker room, you respect them to bring a certain effort, you know, a certain energy. Regardless of your winning or losing. And right there, I just think that's disrespectful to your locker room. It's disrespectful to ownership. And it's disrespectful to the game. There's no excuse for you not playing hard. And that's his whole mystique and movado of him, always running in hard. You see the helmet flying off when he hits a double when it lands, you need to have that same effort when you hit into a double play. And that's the bottom line. Well, I mean, I've met Bryce a few times. He seems like a great guy. But, you know, maybe all those things that are written in the paper are true. Maybe this guy is not the guy that everybody thinks he is. I just feel like for him, that, with the way the Washington Nationals are playing right now, man, that hurts. If I was one of his teammates and I saw that effort, if we were 20 games above 500, that's different. But we're struggling, man. We're looking for guys to step up. And when we're looking for Bryce Harper to step up, he's nowhere to be found. And then when you look at Max Scherzer a day ago, running out of base hit, and he's your star pitcher. That's it. That's the effort. So it's just, it's no excuse. You've already had to meet him. Here's Scherzer, Tray, to your point. This is your star pitcher on an infant town. Head down. Look at him. Head down, smelling a base hit so he can turn the line up over for his teammates to win a ball game. There's no excuse in that. I'm sorry. I was never the best player on any team, but everybody always respected my effort, regardless if I gave up eight runs. If I had eight shutout, I was always out there working hard, not only for myself, but the name on the jersey in the front was important to me. And I'm always able to earn people's respect in that. Well, I also feel like at this point in time, this is a huge situation for Dave Martinez right now. I feel like first year manager, the team is really, really struggling. Will he step up and take that leadership role in the locker room like all his guys hope he does? I feel like for Bryce, I mean, you never want to get on somebody's effort, but right there, man, it clearly shows that his frustrations are really starting to show. So there's a couple of good points. First of all, I think with Harper, I don't think we're sitting here saying Bryce Harper doesn't work hard. No, not at all. When you are a superstar and your team has been bad and you're trying to figure out aesthetically, you cannot walk to first base on a double play when your pitcher does that the night before. I think you bring up a great point about Dave Martinez. He has been questioned a lot in DC by his own players from when I was told, okay? He's a heck of a guy. He's trying to figure out his first year manager. Now let me ask you this. Based on what you just said, does he have to bench Bryce Harper tomorrow? You're asking me if that's what I would do? No, I'm asking, does he have to do it for the respect of the locker room? In my sole opinion, I feel like the situation the Washington Nationals are in, he needs to step up and take some accountability. He needs to sell Bryce. Hey, that's not what we're going on here. Does he have to bench him? If I'm Dave Martinez, I sit that man for a day. There you go. Because I want to make a statement to my team. What do you think? He should sit himself. That's unacceptable. I mean, that's bottom line. He doesn't want that to be the lasting oppression. People learn a lot about you when you struggle. Right. Everything's all good and you're hitting the ball to the upper deck. It's all easy then. This is the moment where people really measure what's in your heart. And you're hitting around 210. It's not like you're hitting 350. You're hitting 210. I'm sliding head first. Something. Like old man river. I'm searching. I'm sniffing out hits. I'm doing anything I can to get my team on base and get my team going. He's smarter than that. He knows the cameras are on him. He knows, he's just gotta do better. Maybe this is why the Washington Nationals, this might not be their year. I don't think they'll make the playoffs. I don't think so either. I just wish, I'm telling you, I think it is. It could be a seminal moment for Davey Martin. I think it's a huge moment for him. I think you were on to it because it's like, you're trying to figure it out and does he send a message or not? It's gonna be fascinating. I'm fascinated to see the lineup. I'll tell you what. He said he's having that conversation tomorrow. Set boy, seven o'clock, 6.30, I'm calling Bryce. Hey man, we gotta have this talk. And hey, as a pitcher who has called a player's only meeting before, like Scherzer did. And then Scherzer goes out and runs the last night. Scherzer say something to him. Yeah. He has enough clout in that locker room of love hardware and he comes to play every single time his name is in that lineup, he has enough cachet and it's important. And again, the window of winning opens and closes very, very quickly.  They've fired managers. At a certain point, you have to look yourselves in the mirror. He's the best player. One of the best players in all of baseball. He needs to start proving it with his effort and everything else will come. Well also too, man. You saw when Jonathan Papelbaum went after Bryce Harper and they got rid of Pat. Yeah.  And I'm interested to see what shakes down, man. I think this is a huge, huge situation for Dave. And in my opinion, I hope he makes the right one. As the all-star game descends on our nation's capital, the team that plays there is in disarray. Fascinating to watch the next couple of days and see how the nationals react.


Alright, good Tuesday morning everyone. Happy New Year. We are on the floor of the New York Stock Exchange with Jim Kramer. Alright, Jim, it's a new year. We had an incredible run in stocks last year. And remember, as Bob Lang retweeted, you don't necessarily preclude an up year after a big up year. Actually, the data showed the other way. But I think I want to put everyone to read Ken Fisher's column today. He's one of my faves and a friend in USA today talking about how Europe could be better than U.S. Now, obviously the dollar is very weak, so that's going to affect a lot of the Europeans' manufacturers. But I like that call. They had PMI up at 60, and that could mean the raising of rates, which is going to be very good for the banks. So Europe may be better than the U.S. this year, but the U.S. could be strong. And I like the idea that the average has been, after a big rally, up 12% the next year. I think that's certainly doable. I do worry. I don't want to see too much euphoria. I don't want to see too many secondaries, although I think somebody's company should do them. The secondaries I don't want to see are from NASDAQ. But you know what, if we can get tech going, and tech is the one that really kept us down in the fourth quarter of this great old year, then we would see another big rally fang off to a strong start today, which is important because that group has been kept down by, I think, profit-taking. And if that can stay strong, you might have a good day. Speaking of tech stocks, Apple is now offering those batteries now. I think that this was one of those things where Apple is a consumer product company. And if Gillette put out razors and somehow their batteries burned out, then Gillette would have instantly give you a new razor. Apple, if you're worried about your battery, instantly you get a new battery. That's what a great consumer product company does, and that's what Apple is. Unfortunately, it's always covered by tech people who simply just keep making surveys that tell you to sell, sell, sell. And I've never seen a survey that ever said bye-bye-bye. Every survey is negative. How's the stock done during Mr. Survey? And the answer is it definitely, I'd say, non-correlative with the endless sell, sell, sell surveys. And that's one of the reasons why you say you should own Apple and not trade it. Right. I mean, I saw there was a $200 target from Piper, but don't worry. In the next few weeks, you'll see a lot of downgrades. And you'll see a lot because people love to do that. They love to make a name by downgrading Apple. I think they should be more thoughtful and actually analyze the world and what it means for the 8 and the 10 in 2018. And Netflix was upgraded by McRae. I mean, where have they been? Well, I mean, the problem with that is they're talking about how they favor a submodel versus ad. Well, I think that's one of the reasons why the stock has moved so much. I've been talking about the company being miles ahead of everybody else. Well, I think that's well known. The only thing that I thought was interesting was that they do say that they're not going to break the bank making original content. And that's very important because that's been the bare case. Free cash flow, maybe just okay. The call is probably right. Yeah. And it also said that Netflix has changed the way people watch TV. I think we knew that. Well, what? Yeah, look, I mean, it's like the Abbott Labs. We own Abbott Labs for the charitable trust. Axelors Plus. And two people upgraded today. I mean, like we bought it in the 40s and they upgraded it now. Well, the answer is they're just beginning to recognize that St. Jude is going to help this year. Betta leader is not going to be that bad. So what they're doing, and this is going to happen for a lot of companies in the next five days, they're literally saying 2018 is going to be better than you think. Organic growth in the case of Abbott going to 5.56. Everyone will want Abbott on that because that will be one of the great organic growth stories for 2018, if that's the case. And Jim, for the new year, marijuana, recreational marijuana. Yeah, I mean, look, I think that Oregon showed you what it means. Oregon allowed you to do three plants hydroponically. And the sales were really fabulous. 11% of Scott's miracle grow is hydroponic, which is often thought to be marijuana because you can grow it inside. We know that we've seen statistics for states that have it recreational, which show that there's tremendous demand. And I know that a lot of people want to play marijuana stocks. I still insist that the best way to do it is Scott's miracle grow. Jim Kramer, we'll leave it there. There are many more stocks to talk about behind ActionAlertsPlus.com. Let me just make one more point. This is what you're going to see all year. You're going to see comments like the Disney Upgrade today. The Disney Upgrade is based on the fact that you should start thinking about the movies, not about ESPN. In the first five days, there's always a level of optimism that is just like that. It has been this way. And I remember, because in the 80s, I used to go with my kids, well, 90s, but also in the early 90s, I went with my kids to Disney World every single year. And I always remember this period because you would get upgrade after upgrade after upgrade. It's always going to be a sense that this year is going to be the great year. So be aware, you get five days of really unbelievable positives, none of which are really revelatory. But they do tend to work. And maybe investors stop obsessing over ESPN. Yeah, I mean, I think that ESPN, one of the things that has really hurt that stock, is court cutting. But now, if you believe in Fox, you've got international, where cable is not that... You've got India where cable is certainly not a big deal yet. And we've got to recognize that if a movie can make a billion dollars, one billion dollars, that's just incredible business. And I think that people are going to recognize that the movie business, with Toy Story 4, with another Star Wars, with Mary Poppins, which I think is going to be a billion dollar movie, these are things that people have to start thinking about. And if you put those two together, you do want to own Disney through this slog until the Fox deal closes. And I think the Fox deal will work. Hey, by the way, President's tweeting a lot of stuff. Let's remember, President means deregulation, helps oil, helps banks. Banks first out of the chute. We'll see a lower tax rate. We'll hear some tremendous things about growth. Lenard today upgraded because there's so too few home builders. Remember, Horton and Pulte were the two home builders. They were two of the best stocks of the top 10 in the S&P. That'll be a piece coming in real money. So I really just want to urge the people to recognize there's a lot of buoyancy that happens at the beginning of the year. And I don't like it because there won't be next week. Well, it's amazing the home builders did so well given the rising rate environment. You know, and it's unbelievable that Pulte and Horton could be so strong. The textbooks say you should be selling those stocks. I think the shorts are always looking for something to do. And what they did was they went up against these stocks and the commodity place because China looked muted. But take a look at Freeport. It's up at 18. Take a look at the home builders. They're incredibly strong. So the actual book about what's supposed to happen here for hedge fund managers isn't working. And let's watch Facebook, Amazon, Netflix and Google which is alphabet. They all had a really tepid last few weeks. If they can rally, then the Nasdaq, which was the best performer, can have another leg in the first quarter. Alright Jim, we're going to continue the conversation but everyone has to go to ActionAlertsPlus.com to watch us. We have a lot of stuff going today. So many. Thank you. We'll see you there.


And welcome to today's lecture on cache optimization techniques. This is the second lecture on this topic and in the last lecture, we have discussed about the reduction of heat time. As you know, the average memory access time particularly from cache memory is dependent on three important parameters. Number one is heat time, second is miss rate, third is miss penalty. And to improve the performance, you have to reduce one or more of these parameters. That means, first technique that you can use is to reduce heat time and in my last lecture, I have discussed in detail various techniques by which the heat time from the cache can be reduced. Because CPU is reading instruction and data and writing also instruction and data from the cache memory, the performance is critically dependent on the performance of the cache memory. That is the reason why it is very important to discuss about various techniques by which the cache memory performance can be improved. So, today we shall focus on the second technique that means, reduction of miss rate. How we can reduce the miss rate? And in my next lecture, I shall focus on reduction of miss penalty. And so far as for reducing miss rate, you have to use some of the approaches which are listed here. Number one is you can use larger cache size, cache memory size, second is higher associativity, third is large block size, fourth is various compiler optimization techniques. So, we shall discuss them one after the other, but before we discuss this technique, let us focus on another very important aspect which will give you necessary background for reducing the various other techniques for miss rate. And that is an anatomy of cache misses, rather why cache misses occur, what are the different types of cache misses that we can call as anatomy of cache misses. So, to be able to reduce miss rate, we should be able to classify misses by their causes, why these misses occur. And based on the causes, the classification can be done into three broad categories. Number one is known as compulsory misses, these compulsory misses occur because you have to bring blocks into cache for the first time. As you know, when you are turning the power on, the cache memory is not containing any useful instruction or data. So, the cache memory is containing a kind of garbage. So, for the first time you have to transfer instructions to the instruction cache and data to the data cache. So, this is inevitable and you cannot really avoid compulsory misses. And these compulsory misses are also called as cold stirred misses or first reference misses. That means, first time when you are referring a particular block, as you know the cache memory is referred in terms of blocks, that miss will occur. So, it is quite obvious that these misses will occur even when you have got infinite cache. That means, normally we know that if we have an infinite cache, then the miss rate will be very low. However, this compulsory miss will definitely occur because for the first time you have to transfer from the main memory to the cache memory. So, this will happen. Second is known as capacity misses, cache is not large enough. So, some blocks are discarded and later retrieved. So, this is due to smaller capacity of the cache. So, as we know because of cost, we cannot have very large cache memory. And as a consequence, you have to, you cannot really transfer all the blocks from the main memory to the cache memory. So, you have to take only a subset of the blocks from transfer, a subset of the blocks from the main memory to the cache memory. And obviously, whenever a particular block in the cache memory is mapped by a large number of blocks of the main memory, quite often you have to replace that cache memory content and put a new block into it. So, this will happen because some blocks are discarded and later retrieved. So, misses occur even in fully associative cache. As we shall see, there are different types of associative memory you can use. And even when we use fully associative cache, then also then this will happen. That means, you can place it anywhere in the cache memory. So, it is not fixed. And even in this situation, even in this scenario, this will occur, capacity misses will occur. Last but not the least type of misses is due to conflict misses, known as conflict misses. So, blocks can be discarded and later retrieved if too many blocks map to a set. So, the conflict misses occur because as I mentioned, you will be mapping many blocks to a particular set. And as a consequence, you have to replace, bring in and so on. So, these are known as collision misses or interference misses. So, these are the three types of misses that can occur and particularly misses in any way associative. For example, as you keep on increasing the associativity and for a fixed size cache, this factor will change. Later on we shall discuss about it in more details. Although, I have broadly categorized the misses into three types or the misses can occur because of three reasons. There is another reason which we may call as fourth C. So, we have considered about three C's. This is the fourth C. This is known as coherence misses. This is caused by cache coherence. Later on we shall be discussing about multiprocessor based systems. You have got multiple processors having their own private caches and a shared memory. So, in such situation another type of misses will occur and that is known as coherence misses. So, later on when we shall be discussing about multiprocessor systems, this particular type of misses will be discussed in detail. Now, let us consider the three C's and find, let us see what is the miss rate for the different types of misses. As you can see, the bottom red line, I mean that is a very small portion here. Those are compulsory misses. That means we find that the compulsory misses occur because of compulsory misses their rate is much less compared to capacity and conflict misses. That means compulsory miss is insignificantly smaller compared to capacity and conflict misses. This white portion corresponds to the capacity misses, particularly even when you have got fully associative cache. These are the miss rates and obviously as you increase the cache size, as you can see the miss rate is decreasing. Conflict misses are due to different types of associativity. That means capacity misses are because of the limited size of cache. As you can see, as you increase the size, the miss rate will decrease because of capacity misses. However, if you increase the associativity, as you can see the miss rate decreases. The top portion, the blue portion is due to, I mean whenever you have got direct mapping. That means your miss rate is maximum whenever you are using direct miss direct mapping. As you increase the associativity from one way to two way set associativity, four way set associativity, eight way set associativity. As you can see the miss rate is gradually decreasing as represented by different colors. That means the blue portion corresponds to one way set associativity. That means direct mapping the red portion because of two way set associativity and the yellow one corresponds to four way set associativity and the blue one corresponds to eight way set associativity. The white portion as I have told, even when you have got fully associative cache, there will be misses because of capacity misses. Now, let us focus on how the miss rate decreases, I mean changes as you change the size. For example, if the size of the cache is 2 k B, we find that miss rate is a little more than 0.04. 0.04 that is the miss rate, that means about 4 percent. 4 percent cache misses occur when you have got 2 kilobyte cache memory. As you increase the size from 2 to 4, as you can see the miss rate is decreasing, it is less than it is little more than 3 percent. So, little more than 4 percent to little more than 3 percent, there is a decrease as you increase the size. And thumb rule is as you increase the size, if you make the size double, that means 2 kilobyte to 4 kilobyte, the miss rate decreases by 25 percent. This corresponds to, I mean this is corresponding to the full associativity. Now, let us consider whenever you have got direct mapping technique, in such a case when you have got 2 kilobyte cache memory, you can see the miss rate is little more than 0.1 that is little less than 10 percent. On the other hand, whenever you increase the size to 4 kilobyte, then the miss rate reduces from little less than 10 percent to little more than 6 percent. So, roughly about 7 percent. So, here also 25 reduction in miss rate occurs. Obviously, this reduction question arises, due to which miss does it reduce? This reduction occurs because of capacity misses, as I have already mentioned in my earlier with the help of our earlier slides. Now, earlier we have seen the different types of miss rates for different reasons, compulsory capacity and the conflict misses. Here, the miss rate is shown and actually the absolute relative miss rates for different types of misses is shown here. So, we find there bulk of the misses occur because of capacity misses and as I mentioned earlier, the compulsory misses which is represented by the red portion, you can see the miss rate because of compulsory misses is quite small and contrary to reduction in miss rate when the cache memory size increases, the compulsory misses increases because you have to transfer larger number of blocks from the main memory to the cache memory. So, the percentage of compulsory misses increases as you increase the size of the cache memory. The capacity miss rate as you can see is remains from 0 to 60 percent. So, this is the capacity miss and the conflict misses vary for different types of associativity. One way that is direct mapping, two way, four way, eight way. So, for different types of associativity, the percentage of misses are shown in this particular diagram. Now, we have we can see that the miss rate can be reduced by controlling three parameters cache size, associativity and increasing the size of the block. Now, how they affect the three types of misses that means three C's that we shall see in little more detail. So, first let us focus on larger cache sizes. We have seen as we increase the size of the cache memory, the different types of misses changes. So, how the three types of misses are affected as we increase the size of the cache is considered here. So, larger caches are obvious ways to reduce capacity misses. So, capacity misses will reduce as we increase the size of the cache. However, larger caches have higher hit times. So, as we increase the size of the cache memory, the cache memory becomes increasingly complex. As the increase becomes increasingly complex, the decoder portion will be quite complex and the delay for that access will be larger. So, hit time will increase as we increase the size of the cache. So, larger cache size of higher cost obviously as we put more and more cache memory, the cost increases. So, these are the factors which changes. So, L2 caches have become larger, not true for L1 cache. Particularly whenever we consider L1 cache, their hit time is a very important parameter because most of the time data and instructions will be read from the L1 cache. So, there we try to keep the size quite small, not very large. So, that is hit time is very small. However, whenever we go for L2 cache, then size is significantly larger compared to L1 cache. Second important parameter as I told is higher associativity. Higher associativity reduces conflict misses as we have seen in the diagram. If we go for fully associative cache, then the conflict miss will be minimum and as you reduce the associativity, go towards direct mapping the hit rate increases. So, higher associativity increases hit time. So, the reason for that is whenever we go for higher associativity, cache becomes more complex. So, direct mapping is the simplest type of cache memory. You can use conventional memory as the cache memory whenever you use direct mapping, but whenever you go for two ways, say associativity or four ways, say associativity or fully associativity, then the cache memory becomes increasingly complex and as a consequence, the hit time will increase as we increase the associativity. And another observation that we have seen from the diagram, associativity higher than 8 way is likely not useful. We have seen in our previous diagram, after 8 way set associativity, there is no significant reduction in miss rate if we increase the associativity. So, there is no point in going beyond 8 way set associativity. If we incorporate associativity in the cache memory, 8 way is the limit beyond that it does not we reach a point of no return. So, beyond that there is no benefit that is the reason why the associativity is restricted up to 8 way set associativity. Second observation is done is that there is a 2 to 1 cache thumb rule of thumb. What is that? The miss rate of a direct mapped cache of size n is about the same as 2 way set associativity cache of size n by 2. That means, one parameter is cache memory size, another is associativity. Suppose, the cache size is n and if it is direct mapped say associativity is direct mapped or we can say 1 way set associativity. This will give the same miss rate whenever you have got cache size of n by 2 and you have got 2 way set associativity. So, we find that we can achieve the same goal that means, we can have the same miss rate either by increasing the associativity and reducing the cache size or what we can do? We can go for direct mapping doubling the size from 2 way set associativity. So, these are you can say this is a tradeoff between associativity and cache size for the same miss rate. This particular thumb rule actually holds for caches of 128 k v and obviously, beyond 128 k v we do not I mean consider a cache memory size. So, this particular thumb rule is applicable cause for cache memory for 128 k v and under a smaller than that. Now, let us consider the block size. So, larger block size reduce compulsory misses. So, compulsory misses will be reduced as you increase the block size that is because of spatial locality. We know this is governed by the locality of references as you increase the block size larger block size the adjacent blocks adjacent words are taken from the cache main memory to the cache memory. And as a consequence the next reference whenever the next I mean consecutive address is referred it will be available in the cache memory. So, that is the reason why increasing the block size compulsory misses reduces because of better spatial locality. So, however, larger block size increases miss penalty miss penalty increases the reason for that is whenever a cache miss occurs. If you have got multiple words in the cache memory then you have to transfer all of them before you can resume execution of a particular instruction by the processor. That means, before the control is transferred to the processor you have to transfer all the words of a block from the main memory to the cache memory. That means, the miss penalty increases. However, this can be this problem can be reduced to a great extent by using critical word first. That means, although we shall be transferring all the words of a block, but the critical word which has been referred by the processor is transferred first. So, the processor can resume its operation only after the critical word is transferred from the main memory to the processor and also to the cache and subsequently other words can be transferred. So, this can be done which we shall discuss in my next lecture where we shall consider various techniques for reducing miss penalty. So, this will be one of the techniques and larger blocks may increase conflict misses. You see although it reduces compulsory misses the conflict misses increases the reason for that is whenever we consider a cache memory of same size without changing the size of the cache memory. If we increase the associativity then what happens? Then for a given cache the larger blocks means fewer block frames. That means, the number of suppose for the same size the number of frames is n for direct mapping. If we go for two way set associative although we have got two words in a same block, but the number of frames reduces it will become n by 2. So, as a consequence the number of frames reduces and that will lead to increase in conflict misses. So, therefore, there is a trade off the best block size must be chosen carefully. So, you have to since you can see there are conflicting outcomes. That means, it reduces compulsory misses increases miss penalty and also it increases conflict misses. So, you have to very judiciously choose the size of the block as it is evident from the diagram. You can see here as you increase the block size miss rate initially decreases, but ultimately after reaching a minimum value it again increases. That means, particularly when the size of the cache memory is small then we should use a relatively smaller block size. In other words the block size should never be comparable to the size of the cache memory. So, when the size of the cache memory is large as you can see then if we increase the block size it does not affect much. That means, when the size of the cache memory is small it is affected more if we increase the size of the block, but whenever we have got a large cache memory by increasing size of the block it will it does not affect much I mean the miss rate is not affected much. So, what we can say that the tradeoff is based on the available size of cache memory you have to decide about the size of the block. So, this is a simple I mean case study a real life processor, Intrinsity first mat processor that is an embedded microprocessor that uses MIPS architecture and this particular processor is used in many embedded application. It has got 12 stage pipeline 16 kb kilo by 8 cache memory each of 4 kilo words I mean that 16 kb cache means 4 kilo words and 16 word block. So, you can see here you have got a block that the block size is quite large because each block is containing 16 words and these are the different components I mean this is the address 32 bit address which is divided into different parts you can see. Now, we shall focus on various compiler optimization techniques. So, ways in which code can be modified have fewer misses. That means, so far what we have discussed those are those are to be implemented in hardware and programmers or compiler writers are not bothered about that either you will increase the size of the cache or you will increase the associativity or increase the size of the block. All these things are related to change in hardware and the programmers are very happy with that, but now we shall discuss some techniques which are actually based on optimization of the compiler and this optimization can be either be done by the compiler or by the user themselves and McFerling reported back in 1989 that 50 percent reduction in cache misses using 2 kilobyte cache can take place by using compiler optimization and 75 percent reduction in cache misses can occur on 8 kilobyte direct map cache by using by adopting compiler optimization techniques. Essentially, what is being done? Re-order instruction so as to reduce conflict misses. So, primarily by reducing the conflict misses because size has been kept fixed simply by reordering the conflict misses are reduced and that leads to reduction in I mean miss rate. So, we shall discuss several techniques compiler optimization techniques. First one these are the most popular techniques number one is merging arrays. We shall see how we can merge more than one arrays into one and that will improve spatial locality by simple array of compound elements versus two separate arrays that we shall discuss in detail. Second is loop interchange by changing nesting of loops to access data. So, there will be no change in the number of instructions to be executed simply by changing the order of the nesting of loops will be able to reduce the misses and essentially that will increase the reduce the conflict misses. Third technique is known as loop fusion. So, you may be having two independent loops that have the same looping and same variable overlap. So, the key parameter is that you are using some variables which are common in two different loops. So, instead of accessing separately in two different loops you can have one loop and those once the variable is transferred from the cache memory to the cache memory they will be used for both the loops. So, that is known as loop fusion. The last technique is known as blocking which improves temporal locality by accessing blocks of data repeatably versus processing the whole columns or rows particularly for processing arrays this will be very important. So, these techniques we shall discuss one after the other. So, this is the first technique merging arrays. You can see here we have got two different arrays first one is two sequential arrays one is two sequential arrays. So, one is your int this is the size of the arrays given here and another is another array that is your key. So, these two are these two arrays are accessed separately and you can see the order in which the way it is accessed first you are accessing the array value and then you are accessing key one after the other. However, after merging having a one array structure what you can do you can struct merge int val and then int key. So, in this particular case what will be done you will be accessing an element of val then element of key and element of val element of key in this way you will be accessing and as a consequence what will happen the by doing this the miss rate will decrease because the way it is done. So, it reduces potential conflicts between val and key and because it improves spatial locality. So, because of the improvement in spatial locality this will give you better result and the way you will be this way you know that you will be storing in this way and then accessing in this manner and that will improve the performance because it improves spatial locality. Second technique that we shall be using is known as loop interchange. In case of loop interchange you have got 2 D array initialization. So, int a 200 elements 200. So, it is a two dimensional array and for then you are accessing in this manner for i is equal to 0 j less than 200 j plus plus and for j is equal to 0 j here it is i j less than 200 j plus plus and for j is equal to 0 j here it is i j less than 200 and j plus plus. So, then you are writing into it a i j and is equal to 2. So, here what will it be done you will be in this case first you are reading a value taking a value of i and increasing the value of j from 0 to 200 and you are writing into it. So, that means the way it is done is for one i you are accessing all the elements of j and then you are taking another element of i all accessing all the elements of j. So, this is one way of doing it and alternatively what can be done instead of doing this you can do it this way int a 200 200 you will simply change the order for j earlier it was i for here it is j is equal to 0 j is less than 200 j plus plus. So, and then for simply you have changed the order say here it is i is equal to 0 i less than 200 i plus plus and then a i j is equal to 2. So, in this case what you have done you have simply the earlier j was nested in i now i is nested in j. So, because of this you know there will be lot of changes question arises which one will give you better result actually to answer this one must understand the memory layout of the 2D array the way it is stored in the memory because your memory is one dimensional you are accessing a two dimensional array and that is stored in a one dimensional memory as you know memory is organized in the linear way and that is accessed by the address. So, what you can do it reduces misses by improving special locality whenever you change the order and improves cache performance without affecting the number of instructions executed. So, the number of instructions executed will be independent of what way you do. So, that means I mean both the cases number of instructions to be executed is same, but the way it is stored I mean the way you it is stored here because the array corresponding to that ith you know i is in i 2 increasing from 0 to 200 and in fact it has been stored sequentially corresponding to i and as a consequence it will give you better special locality. That means the second option will give you better option better reductions that means the elements of 2D array are stored in contiguous memory cells the problem is that as I told in computer memory is in 1D way. So, therefore, there is a there must be a mapping from 2D to 1D. So, from 2D abstraction to 1D implementation is taking place and as a consequence the this particular approach will give you better result. You must understand the way the rows and column the way they are stored in the memory. So you have got a 2 dimensional array here it is i and j and here you have got different elements of a ij. So, these are the rows and these are the columns. So, here it is a say 0 and this is the a 0 0 then here the row changes. So, 1 j is equal to 0 and so on and a n minus 1 j is j is your 0. So, first row the first row and different columns will be columns and in this direction you have got different columns. Now the way they can be stored is one is known as row measure second is known as column measure. That means if the rows are stored contiguously if the row elements are stored contiguously in this manner then it is called row measure. On the other hand if the if you store in this manner this element then the next elements of the column then it is called column measure. So, you can see the column measures are stored contiguously first column then second column then third column then fourth column this is column measure and this is row measure. Actually the C programs that C uses row measure that means you are storing in terms of rows first you are storing this row then this row then this row and this row as you can see rows in memory as you increasing the address different row elements are there and these are the different memory lines in of the cache memory. So, matrix elements are stored in contiguous memory lines and they are stored in a row measure way and as a consequence whenever you try to access them in the in the row by in terms of row elements with the help of this program then you get good result. On the other hand if the if it is stored in a different way that means column measure way then this program will not give you good result as you can see there will be that locality of reference that special locality is lost since they are stored in row way and you are accessing in terms of column and as a result this will be this will give you worst result. So, the locality of reference or special locality will be much less as a result there will be many misses that will occur in this case compared to the first case where you are accessing row by row and elements are stored in the row measure manner. Another technique is known as loop interchange. So, here what has been done you can see you have got this is this is the your array k is equal to 0 to 100 and here j is equal to 0 to 100 and i is equal to 0 to 5000 that means you are accessing different elements of x i j and writing into it and doing multiplying with your multiplying with two then you are storing it here. Now, if you interchange i and j so if you interchange i and j and then say for outer one remaining same that k is equal to 0 to 100 and here it is i is equal to 0 to 5000 and lower it is i j is equal to 0 to 100 and x i j is equal to 2 into 2000. So, the sequential accesses instead of striding through memory every 100 words. So, this will give you sequential access of the for different elements of the array instead of striding through memory every 100 words. So, in this case you will be striding through every 100 words, but in the second case you will be accessing sequentially and this will give you improved special locality. So, if you perform this loop interchang, the second option will give you better result because of improved special locality compared to the first one. So, this is the loop interchange example then third is your loop fusion example. So, in this case separate sections of code that access the same arrays with the same loops performing different computations on the common data. As I mentioned earlier here you are having two different loops one here the first loop is let me write down the two different loops. So, first one is for i is equal to 0 i less than n i is equal to i plus 1 and for j is equal to 0 j less than n. j is equal to j plus 1 and a i j is equal to 1 by b i j into c i. So, this is the operation you are doing and you are performing in this manner and this is another loop you have got for i is equal to 0 i less than n i is equal to i plus 1 and for j is equal to 0 j less than n j is equal to i plus 1 and you are performing d i j d i plus 1. So, i j is equal to a i j plus c i j. So, you can see you are performing two different computations one is your this computation where a i that elements of a is being accessed elements of b is being accessed elements of c is being accessed and you are performing this computation and here is another computation where you are performing d i j and also you are accessing different elements of a and c. So, you find that elements of a and c which you are accessing are overlapping although you are performing two different computation in two different loops instead of doing it having in two different loops what you can do you can merge it merge the merge it into a you can have a single loop. For example, for i is equal to 0 i less than n i is equal to i plus 1 and then you have got another j is equal to 0 j is less than n i is equal to j is equal to j plus 1 and you are performing a i j is equal to 1 by same thing which you have done earlier 1 by a b i j into j is equal to j is equal to c i j and also you will do this computation d i j is equal to a i j plus c i j. So, here instead of doing it in two different loops you are performing in a single loop. So, as a consequence you are performing loop fusion and by doing this loop fusion you will be having better result because two misses per axis whenever you access them separately versus for two a and c that means you are accessing a and c which are common instead of two misses only one miss per axis will occur whenever you do by using this loop fusion. So, these two misses per axis will be reduced to one misses per axis because of improved temporal locality as you know in temporal locality you are accessing something you are retaining something which will be needed in near future. In fact, that is what is happening in these two cases. So, for processing this particular first computation and second computation you are accessing once transferring to the cache memory and reusing twice. So, this will improve temporal locality and give you better result. Then the final technique that we shall discuss is known as blocking. So, whenever you are performing dense matrix multiplication this is the code which you have which will be writing. So, i is equal to 0 colon i less than n i is equal to i plus 1 for j is equal to 0 to j less than 1 i j is equal to 1 r is equal to 0 for and you will be doing this computation for k 0 to k less than 1 k is equal to k plus 1 and then r is equal to r plus y i k i k into z k j and also you will be doing x i j is equal to r. So, this you will do and whenever you do this as you can see you have got two inner loops and you are reading all n by n elements of z reading all and all elements of z and read n elements of one row of y refitedly. So, this will be doing refitedly because these are in inner loop and write n elements and instead of doing that that means instead of reading the entire rows and entire columns what you can do you can compute on b by b sub matrix that fits into the cache memory. So, in this particular case it will not fit into the cache memory that means entire all the elements of row and all the elements of column will not fit and as a consequence you will be having lot of misses. So, instead of doing it this way you will be dividing into blocks of smaller sizes as it is shown here smaller blocks and the way it is happening is shown in this particular diagram. So, here as you can see when you are doing without blocking. So, without doing without doing whenever you are computing this is the x array this is y array and this is the z array and the way they are accessed is shown with the help of this diagram that white portion is not yet not yet touched then the light portion are correspond to older access and the dark portion is the newer access this portion.  Similarly, for z you can see a large portion has been is corresponding to older access and this is the dark portion corresponding to the newer access. Instead of doing this if you use the blocking and by changing the code here as you can see you have used the blocking factor be called the blocking factor divided into blocks. So, instead of doing the computation of the entire arrays entire rows and columns you are doing block by block and this is how the different I mean the different access of arrays done is shown with the help of different loops and the capacity misses because of this blocking the capacity misses reduces from 2 to the power 2 into n to the power cube plus n square 2 n cube by b plus 2 n square.  And this exploits a combination of spatial and temporal locality because computation is not really in does not involve simultaneously the entire arrays it is computation is done over a small portion of the array by exploiting that idea you are using exploiting the combination of spatial and temporal locality to achieve this blocking and this can also be used to help register a location and this is after doing the blocking how it is done is shown here in this particular case as you can see in contrast to the previous figure smaller number of elements are accessed earlier you are accessing more number of elements smaller number of elements access for array x, for array y and also for array z and you are doing the computation over this area only. So, one block then we will go to another block in this way block by block you will do the computation and performance will be will improve the total number of computation will not change in this case however the performance will definitely improve. So, with this we have come to the end of today's lecture we have discussed various techniques for reducing the miss rate and we have seen how we can use hardware by increasing the cache size by increasing the associativity and also by increasing the block size we can reduce the miss rate and also we can use various compiler optimization techniques that we have discussed briefly in this lecture which can be used to reduce the miss rate. So, in my next lecture I shall discuss about the reduction of miss penalty because that is the third important parameter which dictates the performance of the cache access. Thank you.