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

Резултати

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

Пребарај: #bliss

当前筛选 #bliss清除筛选
Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #596 · 21.04.2025 г., 11:13

Bliss - Official | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 18.5 - Codename: #Pong - Released: 21/4/25 🔽Download:Vanilla | Vanilla(Mirror) (Recovery Build) 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here 🔖 Tags : #ROM#AOSP#Official#Bliss#V ✨ ChangelogsROM | Device ✍️ Note: - Vanilla only - clean flash recommended - you can use this gapps: here, or flash your choice of gapps/microg if you know what you're doing - ksu disabled bcs of official requirements 🏆 Credits - @Ghosuto7 for DT - Hellboy for Meteoric kernel - Fabian for PA Glyph Implementation - Testers 😎 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #567 · 25.02.2025 г., 13:35

Bliss - Official | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 18.3 - Codename: #Pong - Released: 25/2/25 🔽Download:Vanilla | Gapps (Recovery Build) 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here ✨ Source Changelogs: Here 🔖 Tags : #ROM#AOSP#Official#Bliss#V ✨ Changelogs Rebase tree so clean flash is necessary ✍️ Note: - Both Gapps and Vanilla build available - ksu disabled bcs of official requirements, for kernel with ksu flash this 🏆 Credits - @Ghosuto7 for DT - Hellboy forMeteoric kernel - Fabian & Hellboy for PA Glyph Implementation - Testers 😎 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #539 · 29.01.2025 г., 17:05

Bliss - Official | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 18.2 - Codename: #Pong - Released: 29/1/25 🔽 Download: [ Vanilla | Gapps ] (Recovery Build) 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here ✨ Source Changelogs: Here 🔖 Tags : #ROM#AOSP#Official#Bliss#V ✨ Changelogs - Update to NOS V3.0-250113-1723 firmware - Improvements to system performance and stability ✍️ Note: - Both Gapps and Vanilla build available 🏆 Credits - Chandu for base DT - Hellboy for Meteoric kernel - Fabian for PA Glyph Implementation - Testers - Note: bliss is not patched with ksu due to official requirements 😎 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #494 · 21.12.2024 г., 10:21

Bliss - Official | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 18.1 - Codename: #Pong - Released: 19/12/24 🔽 Download: [ Vanilla | Gapps ] (Recovery Build) 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here ✨ Source Changelogs: Here 🔖 Tags : #ROM#AOSP#Official#Bliss#V ✨ Changelogs - Switch to armv9-a and kryo300 CPU variants - Improvements to system performance and stability ✍️ Note: - Both Gapps and Vanilla build available 🏆 Credits - Chandu for base DT - Hellboy for Meteoric kernel - Fabian for PA Glyph Implementation - Testers 😎 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #476 · 24.11.2024 г., 07:09

Bliss - Official | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 18.0 - Codename: #Pong - Released: 24/11/24 🔽 Download: [ Vanilla | Gapps ] (Recovery Build) 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here ✨ Source Changelogs: Here 🔖 Tags : #ROM#AOSP#Official#Bliss#V ✨ Changelogs - initial A15 official build - Pre rooted allowed in official builds, flash the ksu version youself ✍️ Note: - Both Gapps and Vanilla build available 🏆 Credits - Chandu for base DT - Hellboy for Meteoric kernel - Fabian & Hellboy for PA Glyph Implementation - Testers 😎 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #406 · 23.08.2024 г., 07:20

Bliss - Unofficial | Android 14 | Nothing Phone (2) ✍️ Details: - Version: 17.7 - Codename: #Pong - Released: 23/08/24 🔽 Download: [ GDrive ] (Sideload Build) 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here ✨ Source Changelogs: Here 🔖 Tags : #ROM#AOSP#Bliss#QPR3#U ✨ Changelogs - initial build ✍️ Note: - Meteoric kernel is baked in with prepatched KSU - gapps already included 🏆 Credits - Chandu for base DT - Hellboy for Meteoric kernel - Fabian for PA Glyph Implementation - Testers 😎 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #471 · 11.11.2024 г., 06:47

Bliss - Unofficial | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 18.0 - Codename: #Pong - Released: 11/11/24 🔽 Download: [ Link ] (Recovery Build) 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here ✨ Source Changelogs: Here 🔖 Tags : #ROM#AOSP#Community#Bliss#V ✨ Changelogs - initial A15 build ✍️ Note: - Meteoric kernel is baked in with prepatched KSU - Both Gapps and Vanilla build available 🏆 Credits - Chandu for base DT - Hellboy forMeteoric kernel - Fabian and Hellboy for PA Glyph Implementation 😎 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #442 · 24.09.2024 г., 07:54

Bliss - Unofficial | Android 14 | Nothing Phone (2) ✍️ Details: - Version: 17.8 - Codename: #Pong - Released: 24/09/24 🔽 Download: [ Link ] (Recovery Build - flash with ofox) 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here ✨ Source Changelogs: Here 🔖 Tags : #ROM#AOSP#Official#Bliss#QPR3#U ✨ Changelogs - Add device extras - switch to user build - Add Charging Control - Add dolby support - Improvements to performance and system stability ✍️ Note: - Meteoric kernel is baked in with prepatched KSU - Both Gapps and Vanilla build available 🏆 Credits - Chandu for base DT - Hellboy for Meteoric kernel - Fabian for PA Glyph Implementation - Testers 😎 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #626 · 05.06.2025 г., 14:26

Bliss - Official | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 18.6 - Codename: #Pong - Released: 02/06/2025 - Type: #Vanilla 🔽Download:Here | Mirror | Gapps 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here 🔖 Tags : #ROM#AOSP#Official#Bliss#V ✨ ChangelogsROM | Device ✍️ Note: - Clean flash recommended - KSU disabled bcs of official requirements 🏆 Credits - @Ghosuto7 for DT - Hellboy for Meteoric kernel - Fabian for PA Glyph Implementation - Testers 👤 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2