TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #32 · 7 фев.

Скорее всего уже слышали, что складывать строки через + это плохая практика. Падение производительности, и всё такое. Без лишних слов, давайте измерять: from timeit import timeit def t1(): # складываем 10 строк через + из переменной t = 'text' for _ in range(1000): s = t + t + t + t + t + t + t + t + t def t2(): # склеиваем список строк через метод join arr = ['text'] * 10 for _ in range(1000): s = ''.join(arr) def t3(): # складываем через + но не из переменной а непосредственно инлайн объекты for _ in range(1000): s = 'text' + 'text' + 'text' + ... # всего 10 раз Теперь каждую строку склейки запустим по 10М раз >>> timeit(t1, number=10000) 0.21951690399964718 >>> timeit(t2, number=10000) 1.4978306379998685 >>> timeit(t3, number=10000) 0.2213820789993406 Хм, а нам говорили что через "+" это плохо и медленно ))) 😁 Тут стоит учитывать, что речь идёт о склейке множества длинных строк. Давайте изменим условия: def t4(): t = 'text'*100 for _ in range(1000): s = t + t + t + t + t + t + t + t + t def t5(): arr = ['text'*100] * 10 for _ in range(1000): s = ''.join(arr) def t6(): for _ in range(1000): s = 'text'*100 + 'text'*100 + ... # всего 10 раз >>> timeit(t4, number=10000) 12.795130728000004 >>> timeit(t5, number=10000) 2.642637542999182 >>> timeit(t6, number=10000) 0.2184546610005782 Вот, уже другой разговор, сразу видна разница, в среднем в 6 раз. Но погодите, почему последний тест t6() по скорости такой же как и t3()? Ведь строки теперь в 100 раз длиннее! Это вопросы оптимизации кода, какие простые изменения ускоряют или замедляют выполнение программы. Мы столкнулись с примером обхода обращения к переменной. Например, именно так работает директива #define в С++, во время компиляции подставляя значение переменной вместо ссылки на неё. В Python это тоже работает, но часто ли вы сможете встретить такой способ работы со строками? К сожалению, способ почти только теоретический. В целом, тесты показали то, что мы хотели. Делаем выводы самостоятельно. Полный листинг 🌍 #tricks

Резултати

Пронајдени 58 слични објави

Пребарај: #herramientas

当前筛选 #herramientas清除筛选
BotsGram®

@botsgram_cu · Post #4143 · 25.07.2021 г., 18:14

¿Que puede hacer este bot? @GooofyBot Este bot elimina todas las fotos de desnudos para que Telegram no prohíba tus grupos. Idiomas: inglés árabe (Visto en @botsgram_cu) #grupos#herramientas

BotsGram®

@botsgram_cu · Post #3686 · 19.03.2021 г., 01:40

¿Que puede hacer este bot? @famigliacounterbot Family Counter es el bot que puedes usar para contar los mensajes de tu grupo y competir con otros. ¡Agrégalo a tu grupo para que entre en acción de inmediato! Idioma: italiano (Visto en @botsgram_cu) #grupos#herramientas

BotsGram®

@botsgram_cu · Post #3107 · 02.11.2020 г., 19:01

¿Que puede hacer este bot? @matanet_bot Bot para cualquier chat. Elimina mensajes que contienen obscenidades, dejando un mensaje en el chat en el que educadamente pide no jurar. Agrega el bot a tu chat y dale permiso para eliminar mensajes. No se requieren ajustes adicionales. Idioma: ruso (Visto en @botsgram_cu) #herramientas#grupos

Bricolaje y ferretería

@bricolaje_ferreteria · Post #36 · 06.08.2022 г., 11:52

Tipos de rodillos para pintar: ¿cuáles son y para qué se usan? A la hora de empezar un proyecto de pintura, es esencial contar con el conocimiento y la experiencia para pintar Leer más...#pintura#herramientas

🌷Haditas Estudiosas📋

@apuntes_digitales · Post #4883 · 14.07.2023 г., 02:33

🧸 btw encontré esta app y es muy linda para tomar notas rápidas en el cell. 🧴 tiene muchas plantillas y tú puedes insertar las tuyas . (la de la primera imagen es un memo pad que hice hace tiempo) link: https://play.google.com/store/apps/details?id=note.notepad.todo.notebook #recomendadoapps#herramientas

BotsGram®

@botsgram_cu · Post #3035 · 02.10.2020 г., 02:13

¿Que puede hacer este bot? @AntiChannelServiceMessageBot Elimina los mensajes de servicio en el canal. Idiomas: inglés indonesio (Visto en @botsgram_cu) #canales#herramientas

Panda Tecnologico (OFICIAL)

@PandaTecnologico · Post #655 · 18.08.2024 г., 23:50

Banda, les dejo por acá un sitio web súper interesante donde pueden encontrar herramientas útiles para desarrolladores y personas en el campo de la tecnología de la información (TI). Si tienen sugerencias de herramientas para añadir o desean reportar algún error, pueden hacerlo desde su repositorio de GitHub. 🔗http://it-tools.tech #Recomendación#Herramientas

Bricolaje y ferretería

@bricolaje_ferreteria · Post #40 · 04.09.2022 г., 17:33

¿Lo sabías? Curiosidades de la cinta métrica: el uso del borde dentado y la punta agujereada La cinta métrica es una herramienta que utilizamos cuando debemos reparar algo de nuestra casa, o colgar un cuadro. Y la usamos muchas veces sin tener conocimiento de que... Leer más#cintametrica#herramientas

BotsGram®

@botsgram_cu · Post #4321 · 01.09.2021 г., 11:35

¿Que puede hacer este bot? @ggbanbot Global Ban Bot es un bot de telegrama que permite a los usuarios informar y prohibir el contenido que publican. Idiomas: inglés español (Visto en @botsgram_cu) #administración#herramientas

BotsGram®

@botsgram_cu · Post #3860 · 30.04.2021 г., 23:25

¿Que puede hacer este bot? @FeaturesBugsBot Este bot le permite enviar nuevas Funciones e informar Errores de los usuarios del grupo. Los diversos informes se recibirán en un canal de registro. Idiomas: inglés, español, italiano, indonesio, árabe (Visto en @botsgram_cu) #herramientas#grupos#canales

BotsGram®

@botsgram_cu · Post #3608 · 09.03.2021 г., 12:46

¿Que puede hacer este bot? @RobomizBot ‌ Crea publicaciones enriquecidas para sus canales y grupos con botones y funciones avanzadas. 1- ¡Sección de comentarios! 2- Botones en línea! 3- ¡Programar publicación! 4- ¡Fijación de medios! 5- ¡Marca de agua! 6- etc ... Idioma: inglés (Visto en @botsgram_cu) #grupos#canales#herramientas

BotsGram®

@botsgram_cu · Post #3044 · 09.10.2020 г., 01:50

¿Que pueden hacer estos bot? @MultiForwardBot @MultiInoltroBot Con estos bot podrás reenviar automáticamente cualquier mensaje o medio que publiques en un canal a cualquier grupo o canal. * Puedes crear tu Clon (Gratis). * Grupo de Soporte * Versión PRO con más de 20 funciones exclusivas. Idiomas: italiano, inglés, español (Visto en @botsgram_cu) #canales#grupos#herramientas

ПретходнаСтраница 1 од 5Следна