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

Резултати

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

Пребарај: #grupos

当前筛选 #grupos清除筛选
BiA Cerámica Fría

@biaceramicafria · Post #3856 · 30.11.2022 г., 17:34

🏆🙌 🍀❤️🥰⚠️💥🛒 🎊🏷️🪢✏️ Si tu respuesta es SÍ, ÚNETE a este grupo https://t.me/craftingtools que mañana damos inicio a diciembre con esta ✏️ ✏️ ✏️ ✏️ 🍀🙌🎰🎰🎰 🏆 1 Premio por valor superior a 40 MLC: 💙Set de cortadores de acero inoxidable 💙Set de mini cúter 💙4 cortadores de flor con sistema de expulsión 💙3 cortadores de estrellas 💙3 cortadores (oso, corazón y rosa) 💙200 cascabeles 💙Molde de silicona 💙100 Bases para aretes y 100 cierres de acero inoxidable 💙Set de 11 felpitas 💙1 tira de figuras de fomi 🏆🙌 🍀❤️🥰⚠️💥🛒 🎊🏷️🖇️🧿 #grupos

Hashtags

BiA Cerámica Fría

@biaceramicafria · Post #3621 · 20.06.2022 г., 13:50

‼️ Atención‼️ NUEVA 🅞🅕🅔🅡🅣🅐 de compra, esta vez en 𝐀𝐧𝐢𝐦𝐚𝐥𝐞𝐬 𝐒𝐚𝐥𝐮𝐝𝐚𝐛𝐥𝐞𝐬, para los peludos de casa, escamosos y plumíferos también 🐶🐱🐹🐟🦜 Compras por encargo del catálogo SheIn. Use este enlace para unirse👇 https://t.me/animalessaludables https://chat.whatsapp.com/DQf3jDayREZFmsgQe5fvJZ #grupos

Hashtags

BotsGram®

@botsgram_cu · Post #3626 · 11.03.2021 г., 00:53

¿Que puede hacer este bot? @GroupsMusicBot Este bot te permite reproducir música en tus grupos a través de los nuevos chats de voz introducidos recientemente por Telegram. ¡Simplemente agregue el bot en su grupo y lea la lista de comandos para descubrir cómo usarlo! Idioma: inglés (Visto en @botsgram_cu) #música#grupos

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

BiA Cerámica Fría

@biaceramicafria · Post #3662 · 20.07.2022 г., 16:28

Como cada miércoles... Llega un 👆This or That👇 Este no es la excepción y viene con una sorpresa 😍👉entérate de los detalles aquí 👈 y únete a nuestro canal de importaciones 🛍️Accesorios BiA con ropita bonita🛒 #grupos#encuesta#bia_recomienda

BotsGram®

@botsgram_cu · Post #4026 · 17.06.2021 г., 02:28

¿Que puede hacer este bot? @asamsgbot Este bot le permite enviar mensajes privados en chats públicos, los mensajes solo son visibles para el destinatario y el remitente. Sólo funciona de forma inline. Idiomas: español, inglés, italiano (Visto en @botsgram_cu) #mensajes#grupos

BotsGram®

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

¿Que puede hacer este bot? @ThankStickerBot Envía una calcomanía de agradecimiento al grupo cuando alcanza "x" cantidad de miembros. Idioma: inglés (Visto en @botsgram_cu) #stickers#grupos

BotsGram®

@botsgram_cu · Post #4179 · 09.08.2021 г., 15:43

¿Que puede hacer este bot? @KattoRobot Bot de entretenimiento para grupos con comandos, tablas de clasificación y un sistema de puntos para mantener activo a tu grupo. Idiomas: italiano (Visto en @botsgram_cu) #entretenimiento#grupos

BotsGram®

@botsgram_cu · Post #3088 · 27.10.2020 г., 01:55

¿Que puede hacer este bot? @Membership_admin_bot Este bot te ayudará a monetizar tus grupos de telegram, crear grupos privados pagados y vender productos 💵 Puede aceptar pagos 📆 Crear suscripciones 🌐 Dale a tus clientes enlaces de invitación 📌 Enviar recordatorios ⛔️ Prohibir a los que no pagan 🛍Vender Productos Idioma inglés (Visto en @botsgram_cu) #membresía#grupos

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

123•••56
ПретходнаСтраница 1 од 6Следна