00:0.24 For this chapter. We're going to work with a pre built application.
00:3.68 I've carefully constructed it. So it does several different things.
00:7.52 Each of them require lots of work,
00:9.55 some are slower, some are faster and we'll be able to apply different techniques to
00:14.01 actually improve that speed. In this video
00:16.77 We're gonna look at just where we're starting from.
00:19.55 Just gonna do a quick survey of the app.
00:22.34 The notice over here. We're in the performance chapter.
00:24.6 I've said it as the source root.
00:27.74 Here's the overall main starting point for the program.
00:31.57 I've already created a run configuration for it and gave it a name because there's so
00:35.25 many things called program this project and we're just going to have this go method.
00:39.64 I didn't put this directly into the main as well for reasons we'll see later but
00:44.2 we're gonna call this 'go' function.
00:45.46 It's going to do the work of the program.
00:48.24 And that's the thing that we're actually going to profile and figure out what is fast
00:52.08 is what is slow make some changes and measure that there's three basic things that are
00:57.0 happening. We're doing some searching,
01:0.64 we're going to a database and we're doing some machine learning and for each one of
01:6.52 these for the first two were passing in this Key word profiling and we're going to
01:10.34 either do a search over on talk python on 
01:13.58 API there, we're going to search the database for that.
01:17.04 And then we're just going to do some raw machine learning on the results.
01:21.44 Now let me point out all of this besides the actual search bit is fairly contrived
01:25.09 but it's something that we can play with and it's doing enough complicated things that
01:29.71 you'll see interesting results in the profiler.
01:32.44 So let's just take a quick survey first.
01:33.97 We're gonna go over to the services bid and it's going to build a URL
01:38.38 . It's going to perform the search and get a JSON response from the server
01:42.41 back and then it's going to convert that into something that we can display.
01:46.48 Let's actually wouldn't run it real quick.
01:48.84 Here's the talk python search results and it's coming back with the episode number and then
01:53.37 the content that's coming back here that match the search.
01:57.44 So all those are episodes on the Talk Python to Me podcasts that have something to
02:1.13 do with profiling. You pull that up,
02:4.56 there's actually an api over search.talkpython.fm.
02:7.72 So if I go over here and enter something like profiling,
02:11.8 profiling is what we're searching for.
02:14.54 Easy is coming back with things about profiling,
02:17.46 python, profiling, data science and whatnot.
02:20.84 So that's what this is doing you can see here is talking about the right format
02:25.96 for that API requests. So it's going to build the URL down here is going
02:29.75 to use request to get it,
02:31.12 make sure that it worked and then it's going to convert the response into it.
02:36.34 JSON python dictionary actually and then turn that into a list of results with just a
02:42.57 little bit of information like the idea of the episode colon a description and that's what
02:47.68 we see when it comes out there.
02:49.74 So that's the search one. Let's look at the data access one next we're calling
02:53.82 get records or creating a connection and then we're running a query.
02:58.97 We're not going to look at the details of how that's being done just yet.
03:2.61 But given the connection and the search text in this case profile,
03:5.77 go tell me go get all those results from that.
03:9.44 And then up in the program we're just going to print out how many records matched
03:14.12 that result there. And then the third thing we're doing here is some kind of
03:18.07 simulated machine learning. So let's jump over to compute analytics.
03:22.04 So we're gonna read some data on the search,
03:24.46 we're gonna read some rows of that data and then we're gonna do some kind of
03:28.39 learning and it's going to come up with some kind of number again,
03:31.93 let's run it one more time.
03:32.95 You'll see all those steps having.
03:34.44 So here's the search on talk python there's the database thing.
03:37.64 And then finally this is the number that we got back from our machine learning model
03:41.77 whatever that might mean. This is the program that we're going to be using
03:45.91 to explore where it's slow again,
03:48.12 notice how long it takes. If we run it it's running,
03:50.1 it's running we've got one part in other parts done,
03:52.58 another part's done. It doesn't run super quick.
03:55.04 It doesn't come back with an answer right away.
03:57.64 What we want to do is figure out where it's slow and what we can do make it faster.
