Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 12 additions & 19 deletions lectures/kesten_processes.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ import jax
import jax.numpy as jnp
from jax import random
from jax import lax
from quantecon import tic, toc
from typing import NamedTuple
from functools import partial
```
Expand Down Expand Up @@ -235,17 +234,15 @@ Let's try running the code and generating a cross-section.

```{code-cell} ipython3
firm = Firm()
tic()
data = generate_cross_section(firm).block_until_ready()
toc()
with qe.Timer():
data = generate_cross_section(firm).block_until_ready()
```

We run the function again so we can see the speed without compile time.

```{code-cell} ipython3
tic()
data = generate_cross_section(firm).block_until_ready()
toc()
with qe.Timer():
data = generate_cross_section(firm).block_until_ready()
```

Let's produce the rank-size plot and check the distribution:
Expand Down Expand Up @@ -314,15 +311,13 @@ def generate_cross_section_lax(
Let's see if we get any speed gain

```{code-cell} ipython3
tic()
data = generate_cross_section_lax(firm).block_until_ready()
toc()
with qe.Timer():
data = generate_cross_section_lax(firm).block_until_ready()
```

```{code-cell} ipython3
tic()
data = generate_cross_section_lax(firm).block_until_ready()
toc()
with qe.Timer():
data = generate_cross_section_lax(firm).block_until_ready()
```

Here we produce the same rank-size plot:
Expand Down Expand Up @@ -393,15 +388,13 @@ def generate_cross_section_lax(
Here are the run times.

```{code-cell} ipython3
tic()
data = generate_cross_section_lax(firm).block_until_ready()
toc()
with qe.Timer():
data = generate_cross_section_lax(firm).block_until_ready()
```

```{code-cell} ipython3
tic()
data = generate_cross_section_lax(firm).block_until_ready()
toc()
with qe.Timer():
data = generate_cross_section_lax(firm).block_until_ready()
```

This method might or might not be faster.
Expand Down
Loading