Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть Intermediate Python 6. Timeit 영어 파이썬 코딩영어

  • Donghan 코딩영어 어학원
  • 2021-09-06
  • 74
Intermediate Python 6. Timeit 영어 파이썬 코딩영어
팔하나코딩영어코딩어학원파이썬프로그래밍코딩학습법
  • ok logo

Скачать Intermediate Python 6. Timeit 영어 파이썬 코딩영어 бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно Intermediate Python 6. Timeit 영어 파이썬 코딩영어 или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку Intermediate Python 6. Timeit 영어 파이썬 코딩영어 бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео Intermediate Python 6. Timeit 영어 파이썬 코딩영어

LC training(7:59) - Another thing that we could do is compare the following so what if we wanted to compare this is getting messy So let's first write the code and then we'll time it below So we've got div by five we've got the generator expression up here Let us time the iteration I'm going to comment this out for now I'm not going to see it right this moment Let's time how long it takes to do for i in xyz print i So let's run this code so the creation of a generator in the iteration through that generator So we'll copy this will comment it out paste it run it And in fact it's going to print it out oh no ha ~ okay Let's just define a variable Let's just say x equals i It's like printing out to my console That's not on the same screen okay it's fascinating it just it went Now that tells you how slow printing the console is okay Let's try it one more time just cleaning up things okay So this was with the generator and then an iteration through just going off of my memory This is pretty close to how long it took for us just to build the list Now let's do list comprehension So we just changed these two things So list comprehension is slightly faster not by a whole lot But let's add some numbers here and okay So this will be list comprehension How many do we add? So it should take about nine seconds probably i shouldn't have done it for that long But while we're waiting let's just change this to a generator okay nine point four seconds And we'll run it one more time So that was for list comprehension now we'll see how long it might take for a generator But again the whole point of a generator isn't to be fast it's to not use memory But that time it appears to actually in all the other cases it was not faster because remember this was the generator this was list comprehension This is list comprehension this is a generator Interesting but in that case it was faster

Summary & Code results -


앞의 두 단원에 이어서 계속되는 이슈입니다. list comprehensions과 generator expressions 간에 소요되는 running time을 측정해서 비교해볼 수가 있는데, 이 때에 사용하는 것이 timeit module 입니다.
timeit measures the amount of time it takes for a certain snippet of code to run.
간단히 '1-3' 이란 a string of python code로 number variable을 500,000 그리고 50,000,000 숫자를 주어서 수행해보았더니 각기 0.006243, 0.621717 secs가 걸렸다고 나옵니다.

import timeit
print(timeit.timeit('1+3', number=50000000))
자, 본론에 들어가서 list comp와 generators 간에 비교입니다. 역시 앞 강에서 사용했던 div_by_five(num) function을 활용합니다.

import timeit
xyz = (i for i in input_list if dev_by_five(i))
xyz = [i for i in input_list if dev_by_five(i)]
print(timeit.timeit('''input_list = range(100)
def dev_by_five(num):
if num % 5 == 0:
return True
else:
return False
xyz = [i for i in input_list if dev_by_five(i)]
for i in xyz:
x = i''', number=500000))
xyz = [] # the logic of the above list comp how it works
for i in input_list:
if div_by_five(i):
xyz.append(i)
---------------------------------------------------------------
7.570000100000001
[Finished in 7.7s]


원본 비디오:    • Timeit Module - Intermediate Python Progra...  

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]