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. Enhancing Performance with Built-in Tools

bookChallenge: Implementing Benchmarking

Tarea
test

Swipe to show code editor

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
test

Swipe to show code editor

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
test

Swipe to show code editor

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
test

Swipe to show code editor

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
We're sorry to hear that something went wrong. What happened?
some-alt