Скорее всего уже слышали, что складывать строки через + это плохая практика. Падение производительности, и всё такое. Без лишних слов, давайте измерять:
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
#InfinityX#qpr2#Diting#A15
Project InfinityX - v2.8 | Android 15
Released: 8/05/2025
▪️Gapps: Gdrive
▪️Vanilla: Gdrive
▪️Recovery: Ofox
▪️Screenshots
Notes:
It is recommended to use ofox recovery if you are flashing via fastboot.
fastboot flash recovery_ab recovery.img
Changelogs:
• Synchronized with the latest changes
• Device integrity passes (signed build)
• fixed the problem with freezing when the battery reaches 5%?
• KernelSU Support
• Firmware included
• Dolby Audio by default
• HyperOS Camera by default
Credits:
Thanks to @TeamMEX_XDA❤️
Thanks to @zED141 for giving me space on gdrive
By@Jezzay97 | Donate
Follow@xiaomi_12tpro_updates
Join@xiaomi12tpro_chat
#InfinityX#qpr2#Diting#A15
Project InfinityX - v2.7 HotFix | Android 15
Released: 3/05/2025
▪️Gapps: Mirror | Gdrive
▪️Vanilla: Mirror | Gdrive
▪️Recovery: Ofox
▪️Screenshots
Notes:
It is recommended to use ofox recovery if you are flashing via fastboot.
fastboot flash recovery_ab recovery.img
Changelogs:
• Synchronized with the latest changes
• Device integrity passes (signed build)
• Fixed the error when installing gapps due to missing partition.
• Slot 2 problem for Sim cards solved
• Firmware included
• Dolby Audio by default
• HyperOS Camera by default
• and many more changes...
Credits:
Thanks to @TeamMEX_XDA❤️
Thanks to @zED141 for giving me space on gdrive
By@Jezzay97 | Donate
Follow@xiaomi_12tpro_updates
Join@xiaomi12tpro_chat
#InfinityX#qpr2#Diting#A15
Project Infinity X - v2.7 | Android 15
Released: 3/05/2025
▪️Gapps: Mirror | SF
▪️Vanilla: Mirror | SF
▪️Screenshots
Notes:
• Synchronized with the latest changes
• Device integrity passes (signed build)
• Thermal menu was removed for now
• Remove some ARM blobs
• Now with oss kernel
• Fixed some vibration bugs. now works 100%.
• Added KernelSU support
• Improved performance
• Firmware included
• Dolby Audio by default
• HyperOS Camera by default
• and many more changes...
Credits:
Thanks to @TeamMEX_XDA❤️
By@Jezzay97 | Donate
Follow@xiaomi_12tpro_updates
Join@xiaomi12tpro_chat
#InfinityX#qpr2#Diting#A15
Project Infinity X - v2.7 | Android 15
Released: 20/04/2025
▪️Download: Mirror | SF
▪️Screenshots
Notes:
• Synchronized with the latest changes
• Device integrity passes (signed build)
• Workaround for voip audio routing issue using a monitoring service (Whatsapp calls on speakerphone fixed)
• Firmware included and updated
• Gapps build only
• Dolby Audio by default
• HyperOS Camera by default
By@Jezzay97 | Donate
Follow@xiaomi_12tpro_updates
Join@xiaomi12tpro_chat
#EvolutionX#UNOFFICIAL#A15#QPR2#diting
EvolutionX 10.6 | UNOFFICIAL | Android 15
Updated: 27/5/2025
▪️Download: Gdrive
▪️Screenshots
Changelogs:
• The device tree has been completely reworked
• The kernel has also been re-based
• Some new features have been implemented
• Charging with the phone turned off has been solved.
• Xiaomi camera has been updated
• The double tap to wake up has been fixed
• Fingerprint sensor glows when AOD appears has been fixed
• If you want the screen to stay at 120hz, activate it on the screen as minimum frequency.
• LDAC and LHDC support for Bluetooth has been added
• New integrated dolby audio
• KSU Support
• to pass integrity, use your own methods to pass integrity, use your own methods.
• Some more changes have been made and optimized
• More changes coming soon
Credits:
@TeamMEX_XDA
@ArianK16a
@Omar99A
By@Jezzay97 | Donate
Follow@xiaomi_12tpro_updates
Join@xiaomi12tpro_chat
#EvolutionX#UNOFFICIAL#A15#QPR2#diting
EvolutionX 10.6 | UNOFFICIAL | Android 15
Updated: 18/5/2025
▪️Download: Gdrive
▪️Screenshots
Changelogs:
• May 2025 security patches have been merged into our Android 15 QPR2 branch. The latest version is now 10.6.
• voip fixed problem with calls and voice notes whatsapp telegram
• Optimize native executables for Cortex-A76 CPU Cortex-A510
• Optimize dex2oat for cortex-a76 on cortex-a510
• Migrate powershare to soong_config_set
• Set camera override format from reserved via soong config
• Migrate Lineage Health to soong_config_set
• gps: Avoid access of deprecated LocUnorderedSetMap entry
• Migrate sensor-notifier extension config to soong select
• wlan: Drop unused vendor_cmd.xml
• sepolicy: add missing sysfs wakeup nodes
• sepolicy: Allow CAP_SYS_NICE to zygote
• More changes: Here
• KSU Support
• Dolby Audio incluide
• Hyperos Camera incluide
Credits:
Thanks to @TeamMEX_XDA
By@Jezzay97 | Donate
Follow@xiaomi_12tpro_updates
Join@xiaomi12tpro_chat
#EvolutionX#UNOFFICIAL#A15#QPR2#diting
EvolutionX 10.5 | UNOFFICIAL | Android 15
Updated: 12/4/2025
▪️Download: SF | Mirror
▪️Screenshots
Changelogs:
• April 2025 security patches have been merged into Evolution X. Latest version is now 10.5.
• Dolby Audio Included
• Hyperos Camera Included
Credits:
Thanks to @TeamMEX_XDA
By@Jezzay97 | Donate
Follow@xiaomi_12tpro_updates
Join@xiaomi12tpro_chat
#EvolutionX#UNOFFICIAL#A15#QPR2#diting
EvolutionX 10.4 | UNOFFICIAL | Android 15
Updated: 9/4/2025
▪️Download: here
▪️Screenshots
Changelogs:
• some bugs fixed
• interfaces: Add prebuilt hidl interfaces declarations
• pixel launcher problems fixed
• the fingerprint icon has been fixed
• Introduce XiaomiEuicc in hardware/xiaomi
• and many more changes that I am too lazy to add to the list XD
• Dolby Audio incluide
• Hyperos Camera incluide
Credits:
Thanks to @TeamMEX_XDA
By@Jezzay97 | Donate
Follow@xiaomi_12tpro_updates
Join@xiaomi12tpro_chat