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

Резултати

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

Пребарај: #hackingetico

当前筛选 #hackingetico清除筛选
Repositorio data science

@repo_science · Post #3058 · 13.04.2023 г., 13:30

#hackingEtico 🛠️ All in One Hacking tool For Hackers🥇 👩‍💻: Hardik Zinzuvadiya ⭐️: 7.9k 🧮 1.3k 🔗Link ----- Canal principal: @repo_science Cupones: @freecoupons_reposcience -----

Repositorio data science

@repo_science · Post #3056 · 13.04.2023 г., 13:26

#hackingEtico 🛠️ yeswehack/vulnerable-code-snippets YesWeHack present code snippets containing several different vulnerabilities to practice your code analysis. The code snippets are beginner friendly but suitable for all levels! Twitter vulnerable snippets 👩‍💻: Yes We Hack yeswehack ⭐️: 229 🧮 15 🔗Link ----- Canal principal: @repo_science Cupones: @freecoupons_reposcience -----

Repositorio data science

@repo_science · Post #3048 · 12.04.2023 г., 15:45

#hackingEtico 👩‍💻 Web Security & Bug Bounty: Learn Penetration Testing in 2023 Become a bug bounty hunter! Learn to hack websites, fix vulnerabilities, and improve web security online for clients. 🌟 4.6 - 1216 votes 🗣️ Andrei Neagoie, Aleksa Tamburkovski 🔗Link ----- Canal principal:@repo_science Cupones:@freecoupons_reposcience -----

Repositorio data science

@repo_science · Post #3047 · 12.04.2023 г., 15:42

#hackingEtico 👩‍💻 The Complete Ethical Hacking Course Protect yourself from hackers & cyberattacks. Learn penetration testing + build security and coding tools with Python. 🌟 4.5 - 2732 votes 🗣️ Codestars by Rob Percival, Atil Samancioglu 🔗Link ----- Canal principal: @repo_science Cupones: @freecoupons_reposcience -----

Repositorio data science

@repo_science · Post #3045 · 12.04.2023 г., 15:37

#hackingEtico 👩‍💻 Complete Ethical Hacking Bootcamp 2021: Zero to Mastery Learn Ethical Hacking + Penetration Testing from scratch and master the most modern ethical hacking tools and best practices for 2021! You will practice real techniques used by black hat hackers, then learn to defend against them. ⏱ 26 Hours 📦 232 Lessons 🗣️: Andrei Neagoie & Aleksa Tamburkovski 🔗Link ----- Canal principal: @repo_science Cupones: @freecoupons_reposcience -----

Repositorio data science

@repo_science · Post #3063 · 15.04.2023 г., 16:45

#Python#HackingEtico 👨🏾‍💻 Python Ethical Hacking MASTERCLASS: Zero to Mastery Discover the secrets of ethical hacking with Python: coding essentials, password cracking, penetration testing and MORE! ⭐️4.8 🌐En 🔗Link ----- Canal principal: @repo_science Cupones: @freecoupons_reposcience -----

Repositorio data science

@repo_science · Post #3053 · 13.04.2023 г., 13:02

#hackingEtico#kaliLinux 👩‍💻 Kali Linux: Start Your Ethical Hacking Career with Kali Kali Linux tutorial. Learn Kali Linux from experts, start your ethical hacking journey with my Kali Linux course 🌟 4.9 - 136 votes 🗣️: Muharrem AYDIN, Fatih YILMAZ 🔗Link ----- Canal principal: @repo_science Cupones: @freecoupons_reposcience -----

Repositorio data science

@repo_science · Post #3052 · 13.04.2023 г., 12:58

#hackingEtico#android 👩‍💻 Android Hacking: Ethical Hacking for Android Apps & Devices Android hack| Hacking Android, Android penetration testing, App hacking, Android Ethical Hacking for Android apps&device 🌟 4.4 - 219 votes 🗣️: Muharrem AYDIN, Fatih YILMAZ 🔗Link ----- Canal principal: @repo_science Cupones: @freecoupons_reposcience -----

Repositorio data science

@repo_science · Post #3044 · 12.04.2023 г., 15:34

#hackingEtico 👨🏾‍💻 El #hacking#ético es una práctica que consiste en evadir la seguridad de un sistema informático con el objetivo de identificar las posibles vulneraciones y amenazas que existen en la red. Si quieres aprender más sobre #hackingEtico accede a estos materiales👇 📦Cursos 1-Complete Ethical Hacking Bootcamp 2-Web Security & Bug Bounty 3-The Complete Ethical Hacking Course 4-Android Hacking: Ethical Hacking for Android Apps & Devices 5-Kali Linux: Start Your Ethical Hacking Career with Kali 6-Python Ethical Hacking MASTERCLASS: Zero to Mastery ----- Canal principal: @repo_science Cupones: @freecoupons_reposcience -----

Repositorio data science

@repo_science · Post #3055 · 13.04.2023 г., 13:21

#hackingEtico#hacking_tool#toolkit 🛠️ AzeemIdrisi/PhoneSploit-Pro An all-in-one hacking tool to remotely exploit Android devices using ADB and Metasploit-Framework to get a Meterpreter session. 👩‍💻Mohd Azeem ⭐️ 457 🧮 70 🔗Link ----- Canal principal: @repo_science Cupones: @freecoupons_reposcience -----