and interactive hour for us. So I'm going to share my screen with you. Got a little presentation for everyone here. Great. I wanted to share a little bit about me. Kirstie, thanks so much for having me and for the introduction. And I'll just go through this briefly because Kirstie kind of told you a little bit about me but I spent my early career working in New York City government and large public service government agencies. I studied leadership management, conflict resolution at Harvard University's Kennedy School of Government. I founded and led a charter school in the South Bronx in New York City. And I am currently an executive coach working with tech startups, small businesses and leaders at large organizations. I'm also a psychotherapist with training in psychoanalysis, trauma and energy psychology. Studied Buddhism and meditation in Vietnam. Was there for about two years and got to do some deep study with some of the monks there and got to study at Thich Nhat Hanh who's kind of one of the people who brought mindfulness to the West. Got to study at the monastery where he trained as a young monk. And last but not least, I have three kids and live in Oakland, California. So that's a little bit about me. So I'll tell you a little bit about my new book The Peak Performance Formula and tell you a little bit about what's in it and sort of just give you a kind of broad overview and then I want to get into a little bit of the content. So really what the book is, what I intended it to be was a leadership guide to being your best. And one of the ways I define peak performance is not being the best, but being your best. Really focused on self-improvement, focused on being better than you were yesterday, developing your own skills and your own sense of fulfillment not necessarily competing with others to be sort of the best, which is great. If any of us have the opportunity to be the best at something, awesome, amazing. But what I'm more focused on is really being your best, living up to your potential. And the sort of way that I go about unpacking that is first with an understanding of something that I call the performance paradox. And this is basically how we work against our own success and fulfillment. In many ways, we are designed to survive. That is sort of the, that is our top goal as organisms is to survive. And that can come into conflict with achieving more transcending goals, feelings of fulfillment and accomplishment. And so I really unpack this paradox, this notion that while many of us have things we want to achieve, have goals that we want to attain, we are often our own worst enemies in achieving those goals. And there's a lot of stuff going on in our self-conscious minds. There's stuff going on in our self-conscious minds, which is around kind of what other people think of us, our fear of other people's opinions, fear of failure, our negativity bias that neuroscientists have coined the term negativity bias, ways in which we can really amplify threat and be overly concerned with negative things that are happening as opposed to all the great things that are happening in our lives. And a number of other of these performance paradoxes. So really unpacking how we get in our own way. And then once we understand that, learning a formula, the performance formula for overcoming these obstacles and sort of just in a nutshell, the formula is our purpose, our values and our vision. Being able to have clarity of these three things can take us much of the way to achieving our own potential of performance. And again, that means success and fulfillment. And so learning that formula, understanding deep diving more into purpose, more into values, more into vision, what these things mean, where they come from, how to use them in your own life. And then I get into using the tools and tactics that elite performers use when it comes to managing energy. That's sort of our own ability to be productive without burning out, sort of in athletics. It's like training without overtraining and hurting ourselves or fatiguing ourselves, overly fatiguing ourselves. So how do we manage our energy to perform sustainably day in, day out at our highest levels? Training technique, this is, no matter what we are aspiring to do, there is probably some skill involved. And so what is the best way, the smartest way to train that technique and get better in the things that you need to get better in to attain the goals that you want to attain? So how do we really train technique using tools and tactics of top performers? And then last but certainly not least, training our minds. And so so much of what we do is mental, so much of performance is mental. And so how do we train our minds to again counter many of these performance paradoxes to be able to be focused, to be able to pay attention, to be able to drown out the noise and really focus on what's most important to stay calm, to stay positive. So really how do we train our minds again using the tools and tactics of elite performers? Then I zero in on the most common challenges that I see. This much of this is from my own client base as an executive coach, as well as my work as a psychotherapist, as well as interviewing tons of high performers and sort of reading all the literature I can get my hands on. And these are the things that seem to come up the most. When I'm working with leaders, fear of failure, imposter syndrome, managing the day-to-day stress and anxiety, building one success team and performing in a crisis. So I really zero in on those and kind of give specifics around how do you apply the this formula to these specific kind of challenges.  That's parenting, leadership and organizations. And so parenting, there's been a lot in the last bunch of years around, you see these elite athletes who are now having children and continuing to be elite in their sport, which is great and fine and good. They used to retire and then have kids. Tennis is an example, it's a sport that I play and I follow closely. More and more athletes in tennis are having children and continuing to play at high levels. And that's good, but I'm talking about something a little bit different. How do we actually bring the tools and tactics of high performance to our role as parents? How do we become peak performing parents? How do we have peak performing families by applying purpose values and vision? And so there's a chapter specifically on peak performance parenting. There's a chapter on leadership. This is, you know, we're all leaders, we're all in organizations trying to influence those organizations trying to achieve goals. And so how do we really apply these tools and techniques to our leadership endeavors? And then organizations, how do we ultimately, you know, build organizations that are high performing, that are peak performing organizations? There's a chapter on that. And then the book kind of ends with a 30 day peak performance challenge, where I walk you through in 30 days how to apply the peak performance formula. And that is really to show you how to apply what's in the book in your life. Because I know many of these books have a lot of great ideas and then you put them down and you're like, well, I don't really know how to do this. And so I wanted to give you a guide that you will pick a challenge, something that you wanna make breakthrough performance in over 30 days, and it walks you through the steps of how to do that. And hopefully it also not only teaches you how to apply the what's in the book, but it also helps you build the habits of mine. You know, we do anything for, you know, a month and we begin to develop some habits there. So that's sort of just a sort of, you know, sort of summary or overview of what's in the book. I wanna jump in a little bit, dig in a little bit to these leadership challenges, these challenges that many of us in leadership positions face. And really the challenges that leaders most commonly face.  The first one is really understanding yourself as a leader. And again, this goes back to what's your purpose, what are your values that guide your leadership, choices and decisions and what's your vision? What's your vision for yourself and your own career? What's your vision for the team you lead or the organization that you run? What are your strengths and maybe more importantly and maybe a little harder to look at, what are your flaws? So strengths, obviously these are the things that we're really good at that we should be doubling down on. We should really be leaving from a place of our strengths. But we also need to know our flaws. We need to know the areas where we can really improve and the places where we wanna be careful if we are in a leadership position that we don't project them into our organizations or our teams. And I write a little bit about this notion of projecting our flaws as leaders into organizations. Entrepreneur and venture capitalist Ben Horowitz talks about this projecting your flaws into the companies that you work in, teams you lead, companies you run. And you know, his example is he would always, he loved to get into deep conversation. And so none of his meetings had agendas and they would all run over time and he needed to put in place some safeguards, making sure there were agendas, making sure that there was a timekeeper and people stopping the meeting that would help him to manage his flaw of just kind of loving endless debate. How we delegate, give feedback and make decisions. So obviously, we all know in leadership positions these are key aspects of leadership. We're not individual contributors anymore. We're now leaders, we're managers, we need to delegate. We need to give feedback to help people improve. Sometimes that's hard feedback to give. And how do we make decisions and how are we explicit in our decision making process? Do we know how we make decisions or are we just kind of winging it? And then last but not least here is how do you mobilize and inspire others? Obviously a core to leading a team or an organization is your ability to mobilize and inspire people. And so how do you do that? What's your secret sauce of mobilizing and inspiring others and being clear about how to do that and continuing to refine and develop it? Okay. Second major challenge, energy management, which I spoke a little bit about in the previous slide. This is again about productivity, how productive we are, how well we use our time. And this is again going back to sort of an athletic analogy. This is this notion of how much we train versus how much we recover. And in athletics, you spend a lot of time training, you spend a little time competing and you spend a lot of time recovering. And in the world of work, we have it backwards. We spend all of our time competing, working. We spend very little time training, that's like professional development stuff or taking a course.  And athletes sort of, especially over the last decade, have really figured out that it's all in the recovery. Sustainable day in, day out, high performance is about how well we recover. And so a lot of the book talks about this notion of recovery and how we can recover so that we can continue to work at our sort of highest levels day in, day out. So there's this question that always comes up of work-life balance, is it possible? Is it achievable? Is there such thing as work-life balance? And I believe that there is and there's, and there's, I like to think of it as work-life integration or harmony, but there are ways in which we can manage our time, manage our energy so that we can have a more fulfilling work-life and a more fulfilling personal life. The book gets into some of that. And then really burnout avoidance. And this is the ultimate sort of failure of energy management is to be burned out. And many of us have been running on fumes over the last year and a half. And we really need to do some stuff to take care of ourselves to ensure that we are not burned out. And the practices in the pre-performance formula really help you to re-engage with what is most meaningful and exciting to you, as well as some of these energy management practices that help make sure you still have gas in the tank. Because it's very hard, no matter how much you care about something, when you are sort of running on empty, it's very hard to continue to do that thing and bring the same levels of passion to it that you would want to. Okay, self-limiting beliefs is this next challenge that I see leaders most commonly face. And this is, I just read a great quote yesterday from Muhammad Ali, where he said, my only fault is that I don't realize how great I really am. This is coming from Muhammad Ali, best boxer of all time. And I love that it really sums up this notion of self-limiting beliefs. These beliefs that we have, many of which are against subconscious or implicit, that really constrain us from being all that we can be, having all that we can have, enjoying all that we can enjoy. And some of these beliefs fall into these categories of being a perfectionist, believing everything has to be perfect. And if it's not perfect, then it might as well be thrown in the garbage. The controller, the sort of controlling self-limiting belief, I need to be in control of everything. If I'm not in control of everything, it's gonna go to heck in a hand basket. So I really need to, I have to control everything. I can't delegate anything. I can't let anyone else do any of it. I have to be involved in everything. The pleaser, which is that we've all been there. We wanna be liked, we wanna be loved. Many of us have grown up this way of needing to please others in order to feel valuable or lovable. We have to be people pleasers and the costs that come with that, can be then very hard to make tough decisions and to give hard feedback. And the last one and the one that I feel like I deal with most commonly is imposter syndrome. And this is that feeling, despite good evidence otherwise that we are phonies and that we don't belong. And this can get triggered in situations where maybe we don't have the same credentials as others. Maybe we're younger. Maybe we're in an out group. We're not in the inner circle. Maybe we're in some kind of competition. We're applying for a fellowship or we're applying for a job and there's chance of rejection. We're pitching something. We're pitching a company. We're trying to get investment dollars for our venture. Any time when we can get rejected and our ideas can really be questioned as good ones, the imposter can creep out. And so we really need to be able to manage and shift and transform these self-limiting beliefs. Stress, anxiety and almost constant feel of failure. So this is another one I see quite a lot is, especially working with founders, working with those in startups where they are trying to do something that has never been done before. They are often months, if not weeks, away from running out of money. There are competitors biting at their heels and there's this daily stress, anxiety and fear of failure. And there can often also be this fear of, well, if I fail at what I do, then that makes me a failure on this identification with failing at something, meaning that we are failures. And then ultimately it is about how do we design organizations that get the outcomes we want, organizations or teams to get the outcomes that we're looking for. And this is around sourcing, hiring, training and retaining top talent. And it's also about creating a strong, positive culture with clear policies, norms, rituals and cues. And to be able to do this in a sort of methodical way that really again is designed to get the types of outcomes that it is we're looking for. So these are the challenges that leaders that I see most commonly face and that I wrote the book really with these challenges in mind to really help anyone who is dealing with any of these challenges to have some tools and framework to deal with them to manage them, to overcome them. So I wanted to share with you the first peak performance pillar. I wanted to do a little bit of a deeper dive with you all today and share with you this first pillar of peak performance, which is purpose. And purpose goes a long way in dealing with a lot of the challenges that I just shared with you. And I wanna sort of show you the power of purpose. You've probably been hearing about a lot about purpose. I know, I don't know if it's just me because I follow this stuff, but it seems like purpose is sort of popping up everywhere. People are talking about your purpose, find your purpose, live a purposeful life, reconnect with your purpose. And it really seems like purpose has sort of, the time has come with this concept of purpose. And I've been working with studying, practicing ways of really articulating and enacting purpose for many years now. And so I wanna share with you some of what I find and what's in the book. So purpose is the first pillar of peak performance. And purpose is the expression of what's most deeply meaningful to you, who you are at your essence. That's how I define purpose. It helps us clarify what really matters and points us to what we should be using our skills and talents for. And it gives us courage to act in conditions of uncertainty and difficulty. So there's this notion when we're clear on our purpose, it helps us be courageous. It helps us say, it's an uncertain time. It's a difficult time. This is a big challenge, but because I'm clear on my purpose, I know what I need to do and I have the courage to do it. It functions to both ground us and help us move forward. So it's a grounding when we're clear on our purpose, it's grounding it like strengthens our legs underneath us. It sort of gives us this feeling of like, I can sort of handle the situation here wherever I am, but it also helps move us forward. It also helps to propel us in this way of being a North Star. It sort of gives us in the dark of night when we're in that canoe by ourselves and it gives us that we see that North Star, we know the direction that we need to have. We may not know exactly where we're going, but we know the direction is right. And so we can move forward. We can start paddling in that direction. So it really helps us to move forward. It gives us, again, that sort of that courage to move forward and helps us kind of clarify what really matters to us where we should be using our strengths and our talents. Okay, I'll talk a little bit about the benefits of purpose because there's been some interesting research that has come out recently on purpose. It's been, the benefits have been known very well in religion for centuries. Business and science have started to come around more recently and again, there have been some interesting studies that have been done that have shown that people with a strong sense of purpose live longer than those that do not. I think the study found that on average seven years of longevity were found for people who indicated that they were living strong purposeful lives. They had a strong sense of purpose. Purpose lowers rates of depression and anxiety and increases levels of life satisfaction. At work, employees with purpose miss less work, outperform their peers in productivity and tenure and are more likely to be in leadership positions. So you begin to see some of the benefits of having a strong sense of purpose. Moreover, people want purpose. This is not just something that's good to have, but people really want it. And in one study, employees said that they would give up nearly a quarter of their lifetime earnings for work that was meaningful to them. So that's profound. They're choosing meaning over money. They want more meaningful work and experiences. It's not just about the money. It's about the meaning of the work that they're doing. Nearly 90% of millennials reported higher work satisfaction when provided with opportunities to make a positive impact on social justice issues. So again, connecting meaning to the work that people are doing gave higher work satisfaction. Somewhat recently, a third of employees at the company base camp quit after the company banned political and societal discussions. Now, I'm not arguing whether that was right or wrong, but I think one of the things that you see here is that people wanna be able to connect and again, have these sort of conversations of what matters to them at work. They wanna be able to have work be a place where what they care about is in play, is able to be discussed and talked about. And McKinsey has even gotten on the purpose train. In 2020, they released a study called Igniting Individual Purpose in Times of Crisis, all about how leaders and companies could use people's individual purpose, could use their employees' individual purpose in times of crisis, COVID, to really boost employee engagement and employee productivity. So when the smart guy, the geniuses at McKinsey, start producing reports about this stuff, we know we gotta listen. Okay, so I wanna define a little bit more what purpose is. Again, purpose is what's most deeply meaningful to you, who you are at your essence. And let's go a little bit deeper. It isn't a title or a role. Your purpose is not to be the leader of this company or the CEO of that company or the executive director of that organization. It's not a title, it's not a role. It goes deeper than that, it goes below that.  Because they often don't have a strong sense of their purpose. When we have a strong sense of our purpose, a title or a role is just one expression, one way we're expressing our deeper purpose. It's not the be all end all. And so this is one way that purpose can be really helpful, having a strong sense of purpose, is that it frees us from overly identifying with the title or the role that we're currently in and just shows us that that's one way we're expressing our purpose, not the only way. Purpose is always true. So it's not like, my purpose is only true at work or my purpose is only true when I'm hanging out with my friends. Purpose is universal because it's who you are at your essence.  It's who you are at your essence and what's most deeply meaningful to you. So it's always got to be true. Purpose is about impact. So it is about what you are bringing to the world, the expression. And so there is a component to purpose that is about impact. It is about putting out there something into the world that we want to have an impact. We want to be impactful in the world. And so there is a sense of it's not just a sort of personal thing that I kind of keep quiet, I keep to myself, you know, only for me. It does, there is this aspect of it that has an impact and kind of connects with the outside world. Again, it provides guidance and direction. So if your purpose is not helping you, helping guide you in your life is not helping you make tough decisions and choices about what you should be doing and not doing, then you may not have nailed it. You may not have gotten, you know, sort of an effective purpose, you know, articulated. And it stretches us beyond our current limits. So there is this aspect that, you know, purpose is not this sort of comfortable, you know, easy thing, you know, nobody's purpose is to sort of sit home and watch, you know, Netflix all night. Purpose is about aspiring to sort of put the best that we can out into the world and to achieve impact. It's stretching us.  And so there is an element where it should be encouraging us to stretch beyond our current limit, to stretch and grow. Okay, so there is no right or wrong purpose. It's what is uniquely meaningful to you. And so we can't sort of share and we can't sort of take somebody else's purpose. And so I like that purpose, I'm gonna take that. And there's no, and it's nice. There's no wrong right or wrong purpose. It's Fred in there, sorry. It's totally unique, you know, kind of like a fingerprint. It's unique to you. I mean, obviously people can have sort of similar or overlapping purposes, but it doesn't matter. It doesn't matter what anybody else's purpose is. It's again, what is meaningful to you. Okay, so I wanna look at a little bit. I wanna take just a little time without going kind of geeking out on it too much as what is meaningful to us and how do things become meaningful to us? Cause I think this is an important ground and I know that a lot of our purpose actually, it's not some woo, you know, woo woo sort of new age thing that we get from like a Ouija board. It's actually quite neuroscientific. It comes, it has its basis in our biology and our physiology.  And really novelty and reward are the sort of core drivers of meaning. It all starts with the excitement and reward mechanisms in the brain. So the more stimulating and activity is, which is the novelty part and the bigger the potential payoff, which is the reward part, the more likely we are to want to do that thing because it's giving us excitement. It's giving us that stimulation that we crave that our brains crave and it's tapping the reward centers of our brain. So, you know, thank you, dopamine and serotonin for that.  What our amygdala does is it assigns significance to new stimuli. So whenever we have new stimuli, the amygdala is constantly assessing. It's assessing, does this matter? Is this important? Should I be afraid of this? Should I like this? Is this important enough to kind of wake me up to go on alert that I need to pay attention to this? So we have the amygdala doing that. And then we have the hippocampus, which is responsible for memory, for longterm memory. It reviews all of these past experiences that we have to determine if what is happening now is significant to us or not. So it's like, okay, this thing is like, wake me up. This is, I gotta pay some attention to this. Oh, and as after reviewing it, this is something that actually has some meaning to me. This is something I really find meaningful to do. So every time I step onto a tennis court and a ball's coming at me, stimulation goes up.  And I've had a lot of experience in fun times with tennis. This is a meaningful thing to me. So in a nutshell, something registered in your brain is new and interesting. The reward centers of your brain got activated and that compelled you to repeat the experience again and again until it became central to who you are. So that's how in a nutshell, things become meaningful to us. So I'm gonna go through some of the main sources of purpose, the main places that purpose comes from. And in the book, I do a number of case studies. I interview a number of people who are high performers, living very purpose-grounded lives, very grounded in values, very much with a central vision. And so these are some of the people that I interview in the book and some of the themes that came out of that as the sources of purpose. So survival. So I interviewed Ethan Zahn. He's the winner of Survivor Africa and a cancer survivor.  And he has really sort of taken, you know, one survivor, he used the money to establish a organization called Brad Shrew Soccer that does AIDS education and health education in Africa. And was then diagnosed with cancer and decided to make his cancer battle very public and posted, you know, on social media and was very public about what he was going through and is a big advocate now in the cancer research community. And that has really, you know, become one of his kind of central drivers of purpose is really surviving and helping other people survive. A cause or principle can be a strong driver of purpose. I interview Leydon Petong, who is a Tibetan freedom activist was at the time was the president of Students for Free Tibet in New York City. And she's got this deep connection to fighting for just social justice and freedom of in this case of her people, of the Tibetan people. Love and service to others. So I interviewed Dick Hoyt, who some of you may know, we actually just lost him this past year. Dick Hoyt was an endurance athlete who would participate in endurance events with his son who was born of paraplegic in a wheelchair. And he would participate with him in these races, these Ironman races. He would swim with a boat tied around his waist. He would run pushing him in a wheelchair. He would bike with him on a sort of homemade contraption where he could ride on the bike. And he would do that so that his son could have the normal experiences that somebody that was not disabled could have. And he said, I'm just the body, my son is the heart. My son is the reason that I'm doing this. Loss and heartbreak. So this is not sometimes our deepest pain or deepest loss or deepest heartbreak becomes the source of our purpose. So I interviewed Nancy Baker whose daughter was tragically lost to a preventable hot tub accident. Something faulty in the drainage system. And she got her hair stuck on the bottom of the drain and so every parent's worst nightmare. And Nancy Baker who was this sort of introverted painter became this advocate for hot tub safety and became a crusader was on Larry King Live, went in front of Congress, lobbied Congress and ultimately was able to get a bill passed that required certain changes to be made to make sure that this accident that was killing hundreds of children every year would never happen again. And it gave her the courage to act. And she said, when I was on Larry King Live, I wasn't nervous at all. I thought I would be, but it was really the knowledge that I could get my message out was really what drove me forward and gave me courage. Identity, our sense of identity of who we are often can be a source of our purpose. So I interviewed Saraya Sadeed who's the head of a nonprofit organization supporting women and girls in Afghanistan. Now they've been around for 20 plus years. And we know Afghanistan is back in the news again and there's a huge, huge need and kind of humanitarian crisis happening there now. But Saraya Sadeed was a successful business woman in the United States, had some things happen in her life that caused her to question whether that was really what was important to her. And she went back to thinking about her roots in Afghanistan and went back raised a bunch of money under a lot of threat to her own safety, her own personal safety, brought money in and established a bunch of schools for girls and helped the cause of education for girls in Afghanistan because of that commitment, that sense of identity connection to identity. Okay, so I wanna switch gears here now that you know you have the definition of purpose, you understand sort of the benefits of purpose, you understand some of the sources of purpose. I actually wanna give you an opportunity to come up with your own draft purpose statement. And so this is in the book, a lot of the book that each chapter ends with a kind of your turn activity where I guide you through how to be able to articulate your own purpose statement, how to come up with your own set of core values and determine whether you are living those values in sufficiently or if there are some gaps there, how to do some visioning so that you can actually really paint a clear picture of your future vision for yourself when you meet yourself 20 years from now in the future. So that and a bunch of other activities that accompany each chapter and I wanna share with you the purpose activity. So if you have a pen and a piece of paper and you can grab that, that would be awesome. You don't have to share these, this is just for you. So don't worry about sort of being on the spot to share. Okay, so these are, I'm gonna give you a few prompts that will help you to extract the key elements of your purpose. So the first one is like you to think of a time when you felt most alive, most fulfilled, most impactful, what were the key aspects of what made it so meaningful? So think of that time, really try and get to that place, get yourself to that place. It could be a specific moment or it could be a period of time in your life and it could be recent past or it could be a long time ago.  Okay, second prompt.  Just take a moment and jot down what does the organization do? Okay, number three. If you were to ask the people who know you best, what would they say your superpowers are? So these are the people who know you the best. What would they say your superpowers are? This is, these are attributes that come so naturally that you do them just without thinking. Okay, and the last one. So imagine that you have one post on social media that has been guaranteed to go viral. So millions of people will see it and repost it. What does it say? And it doesn't have to be the exact wording. It could be just, you know, the idea. So don't worry too much about like having to get the wording right. And if some of my clients don't like social media, imagine it's a billboard. Imagine you have an opportunity to put, put a short thing up on a billboard that lots of people are gonna see. You know, it's in the middle of Times Square in New York. What would it say? Okay. So now what we're gonna do is I want you to take a look at all the words and phrases you generated and circle the ones that feel most important to you. Circle the ones that have the most kind of energy and power in them for you.  Again, it should be universally true, meaning that it applies to all aspects of your life. It's not just only true in, you know, certain situations. And using this format, you can change this format later, but this is a good starter format. I am blank and that blank is the essence of being who blank and that blank is the impact you have on the world. I am blank. The essence of being who blank impact on the world. I'll give you some examples. So I am my best. That's the essence of being is my best. Who helps others be their best? That's the impact I have on the world. That one is mine. Just to, in all transparency, if I want to be a little bit more poetic about it, a little bit more metaphorical about it, I say I am the vital spark who fires up potential. Then a couple of other examples from clients. I am the learner who challenges myself and others to grow. I am a leader who transforms camps into kendoos. And then one which I love because it's very indicative of the purpose statement. I simplify complexity. So just take a couple of minutes and using this format, using kind of the ideas from these examples to see if you can just get a draft statement. Again, it's a first draft. Okay. So you can keep working on that after we're done, but I want to give you just a couple of tips for using purpose, how you go about using, okay, you have this draft purpose statement now. What do you do with it? So first thing is connect with your purpose daily. Look at it, recite it, really be in contact with it because that's, you know, this is all about having access to it, understanding your purpose, being able to call it up quickly as a sports psychologist. Michael Gervais works with the Seattle Seahawk says, you know, you should be able to recite your purpose in a dark alley. You know, if somebody says, what's your purpose? You should be able to, so it should be short. It should be something that you have, you know, kind of top of mind. So connect with your purpose daily. Use it when you need to increase your motivation and engagement. You know, it's like, oh, here's this thing, like I really need a little bit more, you know, gas in the tank for this.  Use it to help make choices about what you say yes and no to. So this is, you know, purpose is a very good. Is this on purpose or not on purpose? You know, is this new job that I'm taking or that I have the opportunity to take or interview for, is this aligned with my purpose or not aligned with my purpose? Helps you, it helps you make these kinds of choices. Use it as a guide when navigating difficult decisions in times of uncertainty. So again, when there's a lot of chaos and uncertainty, like there has been in the last couple of years and like it seems like there will continue to be, our purpose is really there to help us provide directionality, right? Okay, you know, so next time you have a difficult decision or you need to make a decision where you don't have all of the, you know, all the data, all the facts, use your purpose and see if that helps you. And use it when you need the courage to move forward, you feel scared or stuck and sort of invoke your purpose and see how that helps. Okay, so again, this is all from my new book, The Peak Performance Formula, Achieving Breakthrough Results in Life and Work. You know, the book came out two weeks ago and it was lucky enough to be a number one new release in business health and stress. Eric Schmidt blurbed the book. He said, we all need tools and tactics to achieve at the highest levels, both at work and in life. This book gives you the framework. Thank you, Eric. The book's available on Amazon, Barnes & Noble, Bookshop, and IndieBound. If you wanna support your local independent bookstores, you can buy it on IndieBound.  You know, I'd appreciate it. Love it if you would pick up a copy of the book. Thank you. If you wanna reach me, follow me on Instagram at Bob, underscore Lesser, my website, BobLesser.com. You can also contact me through my website. So, thank you guys very much. I'll stop here, and I think we have some time for some questions. Thank you, Bob. That was a great presentation. Yes, I've been reading your book, and I love your book. So, just FYI, people who are here, please note the library does have copies of this book. There is a waiting list right now, but you can add yourself to the waiting list. But like Bob said, you can also purchase this book at Amazon and Barnes & Noble and other places. There are a few questions, so I'm gonna read some of them. Oh, before I ask you the question, someone wanted you to please repeat them. Muhammad Ali, quote. Yes, yeah. My only fault is that I don't realize how great I really am. Thank you. Okay, so I just see a couple of questions. The first is if one third of employees don't quit unless they can have political and societal discussions at work. And a different one third of employees don't like political and societal discussions at work. What do you recommend the manager to do? Yeah, I mean, I think every company needs to sort of grapple with this. I really just use that data to show that I think people want to be able to bring their full selves to their work. They wanna be able to do work that's meaningful, that's connected to the issues that matter to them. They wanna be able to talk about those things. So I don't think there's any easy answer. The reason that these companies have banned political and societal speeches is because they want people to focus on the work. They don't want it to become a distraction. So I mean, one recommendation would be that just that they create forums for employees to be able to have these discussions that don't interfere with the work day. So they can come up with some policies and protocols that make sure that people are focused on the work, doing the work, committed to the work and delivering the outcomes that they have to deliver, but also have an opportunity to be who they are, talk about what they care about. But the point was that people and especially millennials really care about meaning in work and they're gonna leave places, they're not gonna work in places that say, hey, you can't talk about things that matter to you here. So that was really the major point of that data. Thank you. Another question is, what is the connection between being designed for survival and working against our own success? Yeah, so the connection there is that it really goes back to our nervous systems. Our nervous systems were really designed with the stress response and they haven't, nervous systems haven't evolved over the last thousand years. We are still looking for the Sabre II Tiger and trying to keep ourselves safe from the Sabre II Tiger, right? So this is our stress response system. Many of you are familiar with it, fight, fight, freeze and appease. It's what happens, our amygdala gets activated and we go into stress response. And they've done brain scans that show that social threat, so being excluded, having negative feedback being given to us, being judged unfairly, triggers the same, activates the same part of our brains as when we are under physical threat. So we are just, in many ways, we are just trying to survive and that stress response and sort of not being in charge of our emotions, but really having our emotions be in charge of us is a huge impediment to performance. It's a huge, and we need to be able to keep ourselves calm, relaxed. We need to be in command of our nervous systems in order to perform at our best. So that's one of the ways. Another one of the ways is, again, this negativity bias is what neuroscientists have dubbed the negativity bias. We are much more likely to focus on and amplify negative things in our life. So the example there is we're walking in the forest and we're on the lookout for the twig that may be a snake. And we're gonna pay much more attention to the threats out there than we are to the flowers, the beautiful flower that we can stop and smell and admire and enjoy. And so in the same ways, we amplify negative. We amplify the things that are not going right for us. We amplify our flaws. We amplify the ways in which we are not living up to our own expectations. And we're not able to be as fulfilled as a result, as happy with the accomplishments that we have, with the things that we have really achieved. And so that gets in the way of a lot of our own fulfillment as well as our own day-to-day performance.  And so a lot of this stuff is hardwired into us as opposed to, we have to find some ways to manage that. So we can do really hard things that we may fail at that may feel a little bit scary or dangerous to us because these are the challenges that ultimately lead to our kind of breakthrough achievements. You're on mute, Kirstie. Okay, thank you. Sorry, Bob. Does anyone have any questions? We ran through all the questions in the chat. All right, well, if no one has any questions, I'll thank you, Bob, for doing this author talk with us.  Again, I'm almost done with it. I love all the food for thought and all the exercises. I think about this stuff all the time, since I started reading it this weekend. So I really appreciate it. And it's a great book. I highly recommend it to everyone who's here. So thank you, just no last question. All right. Oh yeah, someone's copying for you in the chat. Thank you. Thank you all. I want to say it's a book that I think you can kind of come back to over time. There may be parts of the book that are more or less relevant to you right now. But I do think it is kind of a guide for leadership, for leading in tough conditions, for consistently improving yourself and moving forward in your life and your career. And so I do hope that it's something that sort of is a reference, a little bit of a reference resource for people to say, oh yeah, that part on, I'm not experiencing imposter syndrome right now, but next year I take this new job where I'm junior and I've less experienced than everyone and I'm experiencing it, what do I do? Oh yeah, there's that piece on imposter syndrome and how to deal with it and how to transform it. Let me read that piece and do some of that work. Absolutely, yes. I think it's something that we can just keep reading and refer to when you need to. So congratulations on the book and the excellent reviews that you've been getting. And again, thank you for sharing your time with us. Someone wrote in the chat. Thank you Bob, very inspiring, looking forward to reading this book. Oh yeah, thank you Peter, appreciate that. Yeah, thank you everyone. Thanks again for joining and taking the time and I hope you're reading and find a ton of use from it. So thank you all. Thank you Bob. Thank you everyone for joining us. I have a great afternoon. Bye.


Hello everyone, I'm Dr. Anand Patil, consultant neonatology and pediatrics, Manipal Hospital, Vartu Road, Bangalore. Parents, today I would be talking to you guys on red flag signs in a newborn with you guys should be aware of when you go to home. The first red flag sign is when you see your baby is having reduced activity. The babies generally have good writhing movements. When you see the activity of the baby has reduced and the baby sleep for about after a feed about 60 to 90 minutes. When you see baby is sleeping longer than usual and very difficult to arouse from the sleep is the first red flag signs which you guys should be aware. Second most important thing is when you see if your baby has refusal to feeds and the baby is not latching on well onto your chest or if the baby has reduced the feeding amount and as well as the frequency. Earlier the baby used to be feeding about 6 to 8 times. Now the feeding has come down to about 3 to 4 times. Third most important red flag sign is when you see baby is passing less urine. After about a week of the baby's life, baby should pass about 6 times urine. If you see less than that, these all signs and symptoms indicate baby has signs of infection. Fourth red flag signs which you guys should be aware of is when you see redness around the peri umbilical area. Fifth when you see baby is looking more yellow because of the neuratal jaundice and the yellowness if it is spreading towards the palms and soles. When you glance the baby's skin, you may see the baby is looking more yellow. That's when the baby has more jaundice possibly and you need to see a doctor. The other important red flag signs which you guys should be aware of is when you see baby has abnormal fit like movements. Generally convulsions in a newborn can present in a wide varied different forms. When you see these red flags, you should rush to the hospital immediately. We at Manipal Hospital, Varthur Road are available 24 bar 7 with round the clock, neonatal and pediatric support. So please reach out to us. Any help if you guys require. Thank you and take care.


Alright, so Rafa Nadal has just gone into the 4th round against Senego and in straight sets. But there was some conversation had at the net during the match and at the end of the match, and this is what Rafa had to say after his match in the post-match interview about the comments that he made or the comments that he said to Senego. This is what Rafa had to say when the interviewer asked about the spiciness of the match. Rafa said, sorry, not spicy at all. I feel very sorry. Now, if I bothered him, I just wanted to tell him something. I did it in a nice way, but I feel really bad. Now I have bothered him. I'm going to talk to him right now. So that was straight after the match, Rafa saying, I'm sorry to have that confrontation with Senego. And it was a weird thing for Rafa because what happened and what we think happened according to multiple sources is that Senego was making very loud grunting noises. That's what Rafa was not happy with. Also, there was some other antics with Senego wanting the roof shut really early before the sun was down and Rafa was like, really? I don't know if that's a thing and they went off court and it was a whole thing. But then the excessive shouting and grunting from Senego, Rafa didn't like that. So he called Senego to the net at four games all in that third set and said, hey, what's the deal? And that's sort of where this whole thing has blown up.  But let me know in the chat in the comments below, what do you reckon? Do you reckon Rafa was in the right to kind of pull Senego up on his antics? Or do you think Rafa should have left it because he was already winning the match anyway? But weird to see Rafa in any kind of controversy. And I think this is a little bit of a stretch of a controversy. But again, that's what happened. Let me know if you agree with Rafa or disagree.


Okay, so this is Antonio Cuny and I'm Maciej Fiorkowski and we're gonna talk a bit about Python and PyPy performance today. And who are we? We are PyPy core developers. We also work on a bunch of other projects. The maybe most well-known one is CFFI, which is a way to call C, a bunch of other projects. We also do consulting and run a company, Barak Software. So, well, let's start with the usual quote, that premature optimization is the root of all evil. And that you usually end up spending 80% of your time and 20% of your code. But it's important to remember that 20% of one million lines is still 200,000 lines. So, it's 20% tends to scale with the size two. And that can cause trouble if your program is not 10 lines of code. We're gonna talk a bit about how to identify slow ports and how to optimize them. So, the first part I'll talk about the profiling tools and how do you go about saying what's wrong and the other one, Antonio will talk how to address those problems. So, yes, the first is identifying the slow ports. What is performance? Like, who ever tried to optimize something? Most people, good. Well, that's a valid question. Usually it's a time we spend doing task x. So, the task x might be serving one HTTP request or computing one protein or doing one of those things. But sometimes it's like number of requests per second. Sometimes it's the latency. And the interesting question here is what sort of statistical property are you actually interested in? Do you care about the average? Do you care about the worst case scenario? Like, I don't know, if you're developing a car break system, the metric you're optimizing is not the average time it takes to break. It's the worst case scenario it takes to break. And this is the metric you're working with. Sometimes you don't care. If you're serving HTTP requests and one in 10,000 requests takes 50 milliseconds more than, well, too bad. Somebody just lost has to press control R, too bad. So, it's important to know what you are trying to measure first before actually starting to measure. Once you know that, it's cool to have some means to measure stuff. So, benchmarks are very good. And if you don't have benchmarks, you might want to just check stuff in production, how it actually works on the real data, and see if Python is your problem or your problem is waiting forever for IO, or the fact that you have 700 microservices, each of them talking HTTP to each other all the time. It's important to be able to quickly determine whether something that you changed, actually changed stuff or it didn't. It's the same as debugging. If it takes you a week to go around and try again the next thing, then chances of optimizing anything are really, really low. No, thanks. So, we already got to the point where we know Python is our problem. So, oh no, looking at top or whatever, we see that Python processes just consume time doing CPU. One important thing is that systems these days are way too complicated to guess. You cannot just stare at the code and then rewrite it differently, and then hope that, oh, but I know how Python works. Do you really? I don't, for one. And you have to actually measure. You have to see, okay, I run this, it gives me five seconds. I run that, it gives me four seconds. This is when, but I actually have a tool to measure that. Again, remember about the bottleneck can be small, but can also be really large and distributed over the place. Profilers, who used Cprofile here? Almost everybody. Who used Plot? No one. So, Plot is a tool done by Dropbox guys, and I think they run it all the time on Dropbox. So, the difference is that Cprofile is a tool that is even based. So, each function is instrumented to report, like, now I'm entering the function, start a timer, now I'm exiting the function and the timer. It's a way to do profiling. Yes, you get time spent in functions, you get trade specs, you get stuff like that. The problem is that it's a relatively high overhead. On CPython, I think it's like two times, roughly. On Python, it's worse. And the problem is that overhead is not evenly spread because overhead is cost per function that's relatively constant. But then, if your function does a lot, then the overhead is small. If your function does little, then the overhead is large. And that's very bad, especially bad on PyPy. So, it skews the results towards putting more emphasis on small functions than large functions. And VMProf is a tool that we, me and Antostar, are working on this year. This year, last year, something like that. And it's like a statistical profiler. So, it will sample your code as it's run and see, okay, now I'm in this function. Then wait 30 milliseconds, where am I now? Wait 30 milliseconds, where am I now? And try to capture those stacks and give you statistical information. So, it won't tell you how many times the function got called, but it will tell you how much time statistically likely it's possible to spend there. So, VMProf itself is the tool that was inspired by G-Purve tools, which is a similar tool for C. It's based on an interrupt, so it runs on Linux machine about 300 times a second, which is not granular enough if your program runs for 10 milliseconds. But if you run a big server that runs for seconds or minutes, you're usually fine. And samples the C-stack and works on C-Python and PyPy and possibly different virtual machines in the future. So, the problem while we didn't just use G-Purve tools is that C-stack does not contain usually much useful information. You'd see, if you look at the C-stack of C-Python anywhere, you would see that 90% of the time is spent by a level frame. Thank you very much. That's not a useful piece of information, so we want Python level function. The situation is even worse if you have a just-in-time compiler, which I'll talk about later, but we want to be able to reconstruct the Python stack from the C-stack snapshot. Demo. I wanna know. So we have, say, a small program that lets pick PyStone because everybody loves PyStone. Where is PyStone's lead Python test here? So PyStone is a benchmark that's written for Python 1.1, which, who remembers Python 1.1? It was a while ago, I don't even know where. What's translated is from C to Python, the Github and Rustum, and thus a bunch of operations like nice style of what's capital false, for example, zero, predates booleans in Python. So it's a little data benchmark, but fine, let's run it. So I would run Python minus MVM prof, comes as a module, just run it like this. Well, that was like, that probably was not enough. Let's run it slightly. Stop 100 passes. More. No, even more. Okay, now it's running long enough to actually have any useful information. So this will just display the statistical information about which function was spent, how much time, so Proc1 was 37%, but this is a little useless because we don't see who actually called Proc1, what Proc1 called and stuff, so we have a little web tool for that. Web. I'm running this on my local machine because, well, network here, 8,000, zero, I think. We're gonna wait a second, like rerun the benchmark. Okay. So URL, and let's hope it renders properly. Thinking, thinking, okay. So here we see that those like the main code that's called main, then called pystones, that called Proc zero, which called Proc1, Func2, and Proc8, that are directly called by Proc zero. If we do the same thing on PyPy, then we might want more. Then it's relatively similar, except here we can see that, first of all, the split is slightly different. So you can see that PyPy somehow optimized stuff. Remember, those are percentages. So like all of them goes faster, but some of them got much faster than the others. You can see that PyPy is not optimizing equally all the code. And here we might see that it's a number, and that's just code, simply. That piece was compiled to assemble and run. I'm working actively on taking this information and making sure it ends in stuff here so you don't see random numbers. You'll just say, okay, this was 100% jitted. So this is VMProof right now. It's something that we fixed as of yesterday, so maybe you should be slightly careful, but it's good for trying and seeing if it actually works these days. There was Nemo. Yes, yes. It's the runtime overhead of running VMProof is really, really low. It's roughly 5% of the time. So we want to, yes, that's what I have on the next slide. And we are looking into a profiler that is possible to deploy the profiler and run profiling all the time. It's not a thing that you can only run benchmarks on, somewhere in the isolated corner, like cprofile, but you can actually deploy it and get the data coming to you. Which is, again, to another point, we want to have the real-time monitoring of performance. So you're gonna look in last hour or filtered by request or stuff like this. Something that I should probably mention is that we are trying to run this as a service where you would just take the data uploaded somewhere and you do some sort of advanced analysis like what happened? Did the code got compiled correctly? Are there unusual patterns to look for? Well, this is work for the future. Multi-threading right now is at least not tested, which probably means it doesn't work. But the goal is to make it work. Like the signal handlers and everything are designed to work with multi-threading. So we just need to look, how does it look from the Python side? It might obviously work, who knows, but that probably doesn't work. Yes, so as Magik said earlier, when you want to optimize something, you have to spot the parts of the code that are low, and then you have to try to make them fast. Well, there are many ways to make Python code faster, and there is, of course, no time to explore all of them. You can write as the extension, you can use Saiton, you can use Numbau, and you can use Saiton, you can use Saiton, you can use Saiton, you can use Saiton, you can use Saiton, and you can rewrite your Python code using tricks, which you can find on the internet and saying, most of the web pages you find on the web are saying, that there are these tricks, but most of the time they just don't work. They don't make your code faster, but that's another topic. Or you can use PyPy, PyPy is an alternative implementation, which I, how many of you know what is PyPy? Yes, almost everyone, good. Things changed in the things 10 Euro Python's ago when nobody knew what PyPy is a good thing, I think. And yes, PyPy is a Python implementation with a JIT compiler. I'm going to concentrate on this tool in the next, in the next, in this part of the talk, because yes, we wrote it, we are biased, and it's an interesting tool. The nice thing about, in comparing to the other tools I'm talking about is that in theory, PyPy gives you most of the wins for free. You don't have to rewrite your code, you don't have to use another tool, and et cetera, you just run your Python code and it goes faster. Currently, we released PyPy 2.6, which has nothing to do with the Python language version of Python, which PyPy 2.6 implements Python 2.7.9. There is also a release for Python 3K, and if you are interested in knowing more, there are other Euro Python talks during the week. And if you go to speed.pypy.org, you see nice graphs, saying that it's seven times faster than C Python doesn't mean anything. Of course, PyPy is seven times faster than C Python on these benchmarks that we selected. We are not interested in benchmarks in which we are really fast. We try to select benchmarks that shows real-world problems and et cetera, and on these benchmarks, the average is seven times faster. I say that PyPy contains a JIT, which is the part that makes your code faster, and I'm briefly going to explain what is a JIT. So suppose you have this piece of Python code, which contains function codes and loops and et cetera, and if you interpret your program with C Python or PyPy without the JIT, you see that you will spend sometimes in the green part, sometime in the blue part, a bigger part of your time in the red and orange part, et cetera. The idea behind the JIT is that we can optimize the slower spots by compiling them to assembler so that they execute much faster, and then the total time spent in your training your program is lower. And of course, I cannot go in details because there is no time, we are a bit in a rush, but how does it work? The key idea is that first we compile only the spots which are slower, which are executed for the most time. And then how do we make them fast? Well, we do it by specialized code, basically. So if we see that a certain loop or a function is run with integers, like we have an addition with integers, we produce a specialized version of assembler which knows that these variables are integers, and if later, by chance, we see that we have floats or strings or lists or whatever, we produce another specialized version of your Python code which is fast on these new types. And the idea is that you pre-compute as much information as possible during the jit compilation phase so that once you have finished, your assembler code does only the interesting things and the ones who are really needed for your code. For example, suppose you have this line of code, which is, well, it happens very often in Python program, object.foo, it's a method call, and this is a very simplified version of what's happening. So first of all, we look up foo in the dictionary of the object, of the instance. Then if it's not found, we look up it in the class, and then if it's not found in the class, we start looking it up in the base class and the base of the base class and et cetera. And finally, when we found it, we execute. And if you are interpreting, you have to do these steps again and again and again. Suppose you have this object.foo in a loop that you run it one million times, you have to do a look up one million times. And so the idea is that in PyPy, you pre-compute the look up so that you know which function code corresponds to foo, and so you can jump directly to it. But of course, well, Python is dynamic, so things can change because I could change the class of the object. I could add and remove attributes either on the object or on the class, and I can do all sorts of tricks. And these tricks are done in real world programs. So the idea is that we compile the code pretending that object.class is constant and that the class hierarchy is constant. And so we can do the inlining, do constant propagation, and et cetera. To make sure that our code is still behaving correctly, we insert a guard, which is a quick runtime check that we do, that our assumptions are still true. If the guard fails, then it means that the assembly code we are executing is no longer valid or no valid for this case. And so we bail out and we start interpreting things. Yes, it's going to be slower, but it's better to be slower than be incorrect, of course. And eventually we compile a new version of the assembler for these new assumptions, et cetera. So at the end, we get a situation in which all the parts of the code which are executed often are going fast because we have just compiled everything. The hard part is who decides what to specialize on. Because, for example, as I said, we specialize on the class of the object. And but we could specialize on the number of the attributes or if the object starts with O or something like this. There, basically, we have to do some heuristics and the PIPI code is written in a way which assumes that something is more constant than the other things. So we assume that usually classes of objects don't change very often, but the value of the attributes can change. So we promote the class amount of the values. And we assume that usually the modules are kind of constant. It's not that we add and remove function to the modules at run times. We can do, in that case, yes, we specialize twice or three times, but it's kind of a safe assumption. And sometimes we just have a constant in the bytecode. So if you write A plus one, one is the constant. And then we assume that the constant is constant, yes. And this is usually true. Of course, specializing as a trade-off because if it's specialized too much, then we spend most of our time compiling new code and not reusing the one which we already have. And so we consume memory and we spend all of the time compiling things. If we don't specialize enough, we produce inefficient code. Because for example, if you don't specialize on the class of the object, we have to do look up again and again. So, yes, it's a trade-off and it's our job to find the best. And T is, brings us to the next point, which is how to write our code in a way that it's friendly to Pi Pi. Of course, unfortunately, we cannot spend much time on T because it's like a topic which can be one week long, not half an hour. But one point of view is that you should not do the things that you have done until now. Usually to optimize pure Python code without using external tools, you did things like trying to avoid method lookups. So maybe you save the bound method in a variable and then call it repetitively or you try to call, yes, you see, this is something that, where is the mouse? This one? Yes. This is something that Guido wrote a couple of years ago. Be suspicious of function method calls because creating a stack frame is expensive. That is completely untrue in Pi Pi because the function are in line. So basically, if you follow this kind of advice, you write the worst Python code because you are trying to optimize it manually. And if you just write nice Python code, the Pi Pi JIT compiler can do it for you. So a couple of points that are a general advice of how you should write Python code, simple is better than complicated, which means that if you write really plain Python code, which is self-explained and that you can understand it well, well, probably the JIT compiler can do it as well and it has a better clue on what's going on and it has better chances to optimize it. You should avoid to do string concatenation in the loop because the S&C Python is usually fast because there is one optimization which works only if your string is only a reference count of one. You can't do this optimization. So you should avoid it, both on C Python and Pi Pi. You should try to avoid ITER tools, monsters. Sometimes I see pieces of code which are an ITER tools called to another ITER able to generate all which calls another ITER tools and et cetera and I have no idea what it's doing and if you have good for you. And but this kind of confuses the Pi Pi JIT. If you just write your nice Python loop and with nested loop and explain what you are doing, there are chances that the JIT can optimize it as well as ITER tools or even better. The other usual advice is to write stuff in C. Well, no, this is good for C Python because the pure Python code on C Python is very low compared to C. But if you write stuff in C, then the Pi Pi JIT cannot know what is happening. So it has to stop optimizing at some point and call to C. If you write everything in pure Python, the Pi Pi JIT has a better knowledge of what's going on and has better chances to optimize your code up to until the best performance it can. And so if you want to interface with external C code, the best thing to do is use a CFFI which works both on C Python and Pi Pi and it's fast and optimized and et cetera. You should avoid the C extensions which are using the C Python C API. We have this compatibility layer, but it's really like an emulation of preference counting and other things and it's very slow on Pi Pi. Yes, it works. It's useful if you want to try your software and et cetera. But if you're using a C extension with using the C Python C API, in a part of the code which is important from a personal point of view, it's going to kill all your personas. And then you should try to avoid things which confuse the Pi Pi JIT in the way I was explaining earlier. For example, we assume that the class is a constant and classes are kind of fixed from some point on. So you should avoid creating classes at runtime. If you have a function call and inside the function you create the class and then you return an object after instantiating this class. Yes, this is valid Python. It works on Pi Pi, but then the JIT will specialize on this new class again and again without reaching a fixed point. It's not that it's not allowed. You can create new classes. For example, during import time because you want to do some metaprogramming and et cetera, it's perfectly valid. But if you create one million classes, well, the JIT will create one million assemblers, basically. And for example, this is an example of what you should not do to optimize your code because if you try this monster saying, apply operator dot atgetter of x and map it to the element of the list and et cetera, well, it's much, much easier to just write the list comprehension. And this is the kind of advice you will find on the web. And if you measure it, on C-Python it's exactly the same speed, so it's not true even on C-Python. And on Pi-Py, the first one is just a bit slower. So please just write your nice Python code which is understandable and the JIT will remove the operator for you. If you want to know more about Pi-Py, we are around for the whole week, so just ask something to us. Tomorrow there is an open space in the A4 room at 18, so it probably will be a Q&A session, so just come and ask. And yes, before the good, yes, right. Machik want to show you a better demo of VM Pro. Yes, so since we have some time, I did, well, we did the experiment yesterday to see a Django example. It's a small Django example and it's obviously rigged to show slow parts in the Pi, so this is the Django example and indexed us some spurious pickle calls. And I guess this is the thing I wrote and wanted to see, can I find this stuff using VM Pro and make sure things work nicely. So I'm gonna run it first on C-Python, so I want to upload it to the local host and I'm gonna run, manage that by run server. And now, because it's Django, it starts like multiple processes when one, like if you just run it like this, you end up profiling the watchdog process which does nothing. Thank you very much. No reload. And then I'll disable threading just in case. Okay, I'm running the server on 48001. I'll look at it. Host, 80001. So it's okay. Good, fine. So I'm gonna run a simple AB and I'm not going to listen to you saying that AB is a terrible tool but I want to just send some requests. So, much, much thinking. Well, it's C-Python so I can probably just stop it. 4,000 requests is fine because there's no JIT warm-up time or anything like that. And then, like, upload the profiling data. Hope, pretty sure it's trying to load fonts or something. Okay, so we have Django doing its job which has billion, call stack of billion functions, handle, run, call, call, get response index. Okay, so I click on index and index actually spent only 47% doing the actual job. But as you can see that dumps here itself spent like 66% of the total thing. So, if you kill that, the spurious pickle that I put there, it should be like 50% faster, okay, fine. Now I'm going to run the same thing on PyPy. Hope, hope, it starts slow and then, like, starts warming up and gets the request faster. This is how JIT works, it takes time to warm up. It really depends on your workload but it's usually something that can run, if you run for five seconds, then it's fine. So, like, this was like 600 requests a second so like about 3,000 requests here was fine. We did measure, yes, this is the longest request, takes 46 milliseconds and here the 50% takes below one. So, you see the warm up is really slow. I think so and then I try using Java and then it's really, really slow. So, it's not that bad but it's still relatively slow. The overhead here of profiling, we checked the other day, it was like, here was like 660 requests a second without the profiler on. So, that's what, 40, below 10% anyway, it's like 8%. If I look, it's really not working, right, here, this. If I look here, okay, I can't scroll to the right because it doesn't render, maybe no, I don't know. So, what I was trying to show is that here, we have normal, the jungle stack which is five billion levels deep and here it goes, run, call, call, response, index, somewhere, somewhere there but the index itself spends far less time than on CPython, like if you click on index, it's like 32% spend on doing index and there's one very, this guy, which is make style and like, what's the name of this guy? It's color style. So, that made me wonder because my little program that returns okay, does not do much coloring as far as I can tell. So, we looked at what's going on there and jungle search, jungle, core, management, color. And one of them, the guy's name, color style. This guy, make style. So, make style does something and as you can see, it defines a class within the function body for no actual reason whatsoever as far as I can tell and this thing alone makes this simple benchmark about 30% slower. Like, if you remove this and do that, hop, we made jungle 30% faster, bye.  This browser thing is not really working. Anyway, questions, I suppose. Hi, thank you for the presentation, it was very interesting and fun. I have two questions. The first one is about profiler, the both of the questions. Do you plan to support Windows because as far as I understood, you use signals and there are no signals on Windows. So, yes, we plan to support Windows. We didn't make a precise plan just yet how to do it, but probably what you can do is you can just run a separate thread, then the C-level thread and then just sample this. You have to be very, very careful, but maybe things are possible. I don't know. We support Linux right now, 64-bit Linux. We have plans for support, like OSX is in the process and Windows will look how to support, but I don't know yet. If there's high demand, we'll support it. Okay. Oh, for PyPy, PyPy works on Linux, OSX, and Windows, and on 32-bit, 64-bit Intel, except Windows. It doesn't work on 64-bit Windows. You can run. You mean for the profiler or for PyPy itself? So, freebies actually works. It's not officially supported, but it works. People port it. But, journey speaking is the same as for Python. Like, most of the stuff that you are porting are CPython standard library and all the calls there. So, the effort is very, very similar. Like, we use a few extra calls to say compile assembler, allocate this, but as long as you're not supporting awkward architecture, like MIPS or something, then it's relatively easy. Yeah, the second question. About profiler, I didn't quite understood. Is it possible to make cross-profile in between C and Python? And if it is possible, how do you do that? So, what happens is you capture the entire C stack and you have C stack that includes special entries for Python functions. I can show you later. Okay. But like, the idea is that you have all the C calls and then you just throw them away. So, having extra C calls present there is very easy. The only problem is then you need your dwarf data to be present. Like, you need to be able to look up the symbols. But the support is already there. Thank you. Hi. Is it fully compatible with Python 2.7? Can I just replace CPython with PyPy? So, for the most part, yes. The only difference is you might want to look into C extensions, not all C extensions work. But if your code is pure Python, then generally works. Is there a way to check, for example, if a Django project to see if all requirements are compatible? Well, you create virtual and then try to install it. Like, typically what you need to do and stuff like that, you need to replace same MySQL bindings with MySQL CFFI bindings. So, they're usually, for most stuff that's popular, they're equivalent libraries that do the same thing. But instead of being a C extension, use CFFI. So, I can't replace my CPython directly. I have to do some additional work. Depends. If it's Django project, then you usually need to slightly change your requirements. Okay, thank you. So, I have a question. If you want to write a function and you would have multiple ways to implement it and you don't know which one would be there and when you compare the times, then the times kind of get different over time because the garbage collector is always present. You cannot disable it, right? In PipEye. Yes. Yes, but then you just do more statistics. Okay. The average over time. Just running more time, okay. Yeah, okay. But the garbage collector in PipEye is already incremental. So, if you exclude the JIT warm-up time, which is slow at the beginning, then the GC will be spread almost even across your stuff. Okay, because it's assuming that you do a warm-up, but then you will get some spikes in months. Not anymore. We fixed that. Sorry? Not anymore. Oh. We have incremental garbage collector. So, it does a little bit of work. Okay, small spikes, I mean, not that big. Good luck trying to measure them. Okay. Okay, thank you. You're running very quickly into the resolution of your clocks. Like, below millisecond, which is like most garbage collection spikes, the resolution is really bad. Okay. Does Jitting work in a separate thread? Is it one thread or how does it work? Or does it just stop and compile? There is a talk by Armin about how to remove global interpreted lock in Python, but right now PipEye, as it is as you download it, will do everything in one thread. So, part of the deal is that the JIT is a tracing JIT. So, it does some work by running stuff bit by bit. So, you can't do it in a separate thread because you're really running stuff bit by bit. Then, optimizing and emitting assembler, you could, in theory, do this in background thread, which we never implemented. Okay, so now the function approaches, compiles, and then runs the compile version. Yes, for the most part. It's slightly more complicated than that, but yes. More questions? Larik here? No? If I have a project with a Python extension, would it work with PipEye or do I need to change it? So, if you have a new enough Python, it usually works, but it's slow. So, the extension will be slow because it will go through Cpy non-C API. There's some effort to, A, make it faster, and B, I don't know, maybe just make Python compile stuff to CFFI bindings instead of compiling it to C, and then, but that work did not materialize just yet. Yes? No, I want to add something because, for example, something that I did a couple of days ago is to try to speed up something which both on Cpython and PipEye, and I did, like, use the pure mode of Python, so I have the type declaration in a separate file. So, on Cpython, I compile it with Cyton, and it's fast, and on PipEye, I just ignore the Cyton part, and it's pure Python, and it works fast. So, I think this is, like, the best way to use Cyton. Of course, it doesn't work if you want to interface with C library, then you have to use CFFI, but yes. Did you ever measure the amount of time you spent in PipEye? In PipEye, I mean, for example, you have a process, and this process spends some time on doing the work which needs to be done for Python, yeah, Python code, and you have your own GIT and all the stuff in PipEye. Did you ever measure this amount? Yeah, I think you are picking about the time we spend in the GIT compiler, for example. Yes. Yes, well, how can I go back to VMProf? Well, the browser, yes, here. Well, here, in this case, it doesn't work because it shows 100% interpreting, but, for example, VMProf shows you how much time you spent warming up, which means GIT compiling, how much time you spent in the garbage collector, how much time you spent in the interpreter, and the green, well, the green box is GITed. So, I think this is your question? Yes, this is wrong. I don't know, I don't know why it didn't detect the GIT code. Can you check out the sample? Can you try to check out the sample? Yes, well, okay. Well, that's just me. PipEye has zero overhead. I'm not sure I understand the question, like, what do you mean spent time in PipEye? All this time it's spent in PipEye. In PipEye, you do your own work, you need, for example, GIT compilation or garbage collecting, and there is user code, which is wrong. Yes, so we mean how much time we spent in runtime and how much time we spent in user code. So, yes, we will measure that, like, examples of runtime ourselves, DIC lookups, like DIC lookups are not GIT compiled, but it's usually very useless for users to know that, unless you really want to know how much time you spend in big number calculations or stuff like this, then it's usually not very interesting to know how much time you spend in this C functions or how much time you spend in the user code.  Like, that doesn't matter. Yes, but yes, okay? So you mean it's Python overhead compared to what? The same program written on Java? Yes, or maybe in C++? Well, then the answer is like, there's no really good answer for that question because you wouldn't write it the same way. You would use different libraries. You do different things. Like, in some places you would not use a list, you would use a dictionary, stuff like this. Like, if you write the things exactly the same or the speed comparison between Python and Java, that doesn't have a good answer as a question. Like, it really depends on the program a lot. Like, our JIT compiler is quite good. Like, the best case scenario is as fast as Java, roughly. But you don't always hit the best case scenario if you write Python code that looks like, like this, where class style was defined inside, for example, you wouldn't write that code in Java, right? Because you can't do it. So, see, like... Well, you can write it in Java, but it would not be the same inside after compilation, of course. Yes, so the... Python lets you write... If you ask, like, what's the... If you take Java code and write exactly code like Java in Python, then PyPay will be roughly at the same speed with not much difference. If you write code that does tuple of s.upper for s in, like, I don't know, keyword arguments of the function.keys, which you can really write in Java very easily, then it probably will be slower than the equivalent in Java where you actually have to iterate by hand over them, for example. So, it really depends what sort of style you follow. Python lets you do things that are expensive and they're not hard to write, and we are trying to optimize them, but we don't always do as good job. As if you're writing in C, you would never allocate memory yourself because it's paying... It's a real pain to deal with. Because then you have to remember where to free, how to exit the function, but in Python it's very easy to allocate memory all the time. I've seen routinely comparisons of PyPay and C, and in PyPay they used a list and append, and in C they used, like, pre-built buffer of 1000 because allocating lists that you have to resolve is just too hard. But this is apples and oranges, again. Well, I hope that answers your question. Yeah, thanks. Any other questions? Thank you for the talk. My question is, will type hints help PyPay? No. The short answer is no. So the thing is, like, if you do JIT compilation, you know all the types anyway because the types are what's actually there. So you actually know that the longer answer is that type hints are not precise enough for the sort of stuff that PyPay does. Like, PyPay would not only specialize on the class name, it would specialize on what shape of the class is there. So for example, what sort of attributes are present on this precise object. And this is something that you can't express with type hints. So type hints are actually, not even not helping, they're not, you can't do the same things as we do in the JIT. We can do whatever type hints allow you to do, and we do that, and we do more. So I have a question for the VM Prof. That's very interesting. Are you using it to determine where PyPay is relatively not that much better than Cpython? So you did a lot of switching back and forth between the two cases in your webpage. Do you have an integrated view that tells you, in this PyStorm benchmark, for example, PyPay is particularly good in Proc1, but it's relatively bad in Proc3. Do you have that? Do you intend to have that? Because I would presume it helps you find test cases where PyPay can be improved for a given program. That's a very good point. I didn't think about it before, but it's probably something very, very useful. Like to be able to compare, like not even to interpreters, but also like two different libraries, for example, or like two different setups for a function, and like say, okay, if I do this, what actually happens to the profile? That sounds like a good idea. I think I checked about six months ago, and PyPay is incompatible with G-Event. Has that changed, and is it gonna change? Yeah, I think the new release of G-Event will support PyPay. I mean, the trend version already does. Hello, just a quick question about VMProf. Is it possible to customize the sampling rate for sampling? So yes, there is an option to customize the sampling rate. The problem is that Linux signals won't allow you more than like the system clock, which is around 300 Hertz. I think it's there, I don't remember, but it's like around that number that you can't go lower without changing strategy completely to something like threads, which we might need to do for Windows anyway, so. And does it increase the overhead linearly? Yes, yes, obviously. It would, if you sample more often than like, VR 300 Hertz, you have like 30 milliseconds of time in between, and in this time you're doing the job, and also the sampling. Yeah, okay, thanks. Hello, and again, thanks for the talk, and I have the question about the PyPay, so you showed the example that making a class inside the function is bad. It obviously is pretty bad in CPython as well, because of some overhead, but my question is, let's say there's some testing library that mocks the classes, so how do you deal with monkey-patient stuff? Maybe... Depends on the setup a lot, but if you just mock the stuff, and do you mock the stuff for each function? Well, I mean, we are talking about stuff that's called millions of times. If you mock it for like each call of the test function, how many test functions do you have? Like 500, that's definitely not a problem at all. I mean, those test functions won't be jetted anyway, because of run.  Yes, but do you do it million times, or do you do it like 100 times? No, I'm going to do it like several times a run. No, that's completely fine. So it's a float, it's kind of float in assumption. Yeah, yeah, it's only if you're like really having this sort of stuff, like in this example, that this make style is called for every request, and I'm doing 10,000 of those. Thanks, I clarify it, clarifies for me. One more note, it's not that the code is incorrect. I mean, the Python semantics is always preservatives. That's it, if you do this kind of two-dynamic style, maybe you have bad performance, but it still works. Hi, I was just wondering, is there a linter or something that I can run to tell me about that, that the class is a bad idea in the end? No, it would be nice to have, but no. Sorry? Yes. Yes, but yes, let's do it.  This file is from Django, right? Django, yes. This is from Django. Django has code in it that says if we're running on Pocket PC, don't do something. People try to run Django on their Pocket PC on Python? That file is dealing with reading the terminal color palette or something that I'm sure Django does that at all. So maybe it shouldn't do it on Pocket PC, I don't know, but in my opinion, shouldn't be done doing that at all. Are you planning to add support for Python 3.4 and 3.5 in later, in PyPy, any time soon? I didn't understand any of the questions. Are you planning to have the PyPy 3K support for Python version 3.4 and 3.5? Yes, eventually. The problem is that there are not many PyPy developers working on it, and so the development is low, but yes. More questions? No, so thank you very much.