Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Implementing Benchmarking | Understanding and Measuring Performance
Optimization Techniques in Python
course content

Contenido del Curso

Optimization Techniques in Python

Optimization Techniques in Python

1. Understanding and Measuring Performance
2. Efficient Use of Data Structures
3. Optimizing with Python's Built-in Features

bookChallenge: Implementing Benchmarking

Tarea

Let's practice benchmarking by comparing two approaches to squaring the elements of a NumPy array. The first approach, the slower one, uses a for loop to square each element individually, while the second approach leverages vectorization. Don't worry if this concept sounds unfamiliar—we'll discuss it later in the course.

Your task for now is the following:

  1. Define two functions:
    • The first, named square_array_slow, should take a single parameter array;
    • The second, named square_array_fast, should also take the same parameter.
  2. Decorate both functions with the timeit_decorator and set number to 100.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 4
toggle bottom row

bookChallenge: Implementing Benchmarking

Tarea

Let's practice benchmarking by comparing two approaches to squaring the elements of a NumPy array. The first approach, the slower one, uses a for loop to square each element individually, while the second approach leverages vectorization. Don't worry if this concept sounds unfamiliar—we'll discuss it later in the course.

Your task for now is the following:

  1. Define two functions:
    • The first, named square_array_slow, should take a single parameter array;
    • The second, named square_array_fast, should also take the same parameter.
  2. Decorate both functions with the timeit_decorator and set number to 100.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 4
toggle bottom row

bookChallenge: Implementing Benchmarking

Tarea

Let's practice benchmarking by comparing two approaches to squaring the elements of a NumPy array. The first approach, the slower one, uses a for loop to square each element individually, while the second approach leverages vectorization. Don't worry if this concept sounds unfamiliar—we'll discuss it later in the course.

Your task for now is the following:

  1. Define two functions:
    • The first, named square_array_slow, should take a single parameter array;
    • The second, named square_array_fast, should also take the same parameter.
  2. Decorate both functions with the timeit_decorator and set number to 100.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Tarea

Let's practice benchmarking by comparing two approaches to squaring the elements of a NumPy array. The first approach, the slower one, uses a for loop to square each element individually, while the second approach leverages vectorization. Don't worry if this concept sounds unfamiliar—we'll discuss it later in the course.

Your task for now is the following:

  1. Define two functions:
    • The first, named square_array_slow, should take a single parameter array;
    • The second, named square_array_fast, should also take the same parameter.
  2. Decorate both functions with the timeit_decorator and set number to 100.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 1. Capítulo 4
Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
some-alt