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

Резултати

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

Пребарај: #peertube

当前筛选 #peertube清除筛选
Libreware

@libreware · Post #1459 · 07.05.2025 г., 03:54

PeerTube Mobile App v1 Is Out | Linuxiac The PeerTube mobile app has reached version 1, allowing users to easily edit playlists, comment on videos, and switch between accounts Sortie de la v1 de l'application mobile ! | JoinPeerTube PeerTube | F-Droid - Free and Open Source Android App Repository Go to the git page to get version 1.0 the F-Droid link is 0.6 https://framagit.org/framasoft/peertube/mobile-application/-/releases Via @linuxgram #PeerTube

Hashtags

Libreware

@libreware · Post #1265 · 29.03.2024 г., 01:21

P2Play - Peertube client (Unofficial client for Peertube) P2Play is an Android application for Peertube. The features are as follows: - Show list of recent, popular and local videos. - Play videos (very simple) - Log in and register in your instance - Refresh View downloaded videos - Subscribe to accounts - View videos from your subscriptions - Rate videos https://f-droid.org/packages/org.libre.agosto.p2play/ https://instances.joinpeertube.org/instances #PeerTube

Hashtags

Libreware

@libreware · Post #1462 · 04.06.2025 г., 19:45

PeerTube v7.2.0 => https://joinpeertube.org/ PeerTube is a free, decentralized and federated video platform developed as an alternative to other platforms that centralize our data and attention, such as YouTube, Dailymotion or Vimeo. 🎬 Changelog: => https://github.com/Chocobozzz/PeerTube/releases/tag/v7.2.0 Via @dcntr #PeerTube#ActivityPub

Libreware

@libreware · Post #1440 · 21.03.2025 г., 18:20

PeerTube 7.1 brings Podcast 2.0 support, enhanced identification and Mastodon verification | AlternativeTo PeerTubePeerTube has launched version 7.1 of its open-source, decentralized video-sharing platform, introducing a range of new features and improvements. A key update is enhanced platform identification, which now highlights the hosting platform's address for each video. Users can click on this address to learn more about the video's origin and explore all videos hosted on the remote instance. Version 7.1 also advances its support for #Podcast 2.0, enabling users to subscribe to channels and play video audio streams through traditional podcast applications like #AntennaPod and #Podverse. Additionally, the podcast feed is now compatible with Apple Podcast, broadening accessibility PeerTube v7.1 is out! | JoinPeerTube https://joinpeertube.org/news/release-7.1 #PeerTube

GitHub Trends

@githubtrending · Post #15452 · 29.01.2026 г., 19:00

#java#4k#android#bandcamp#download_videos#newpipe#peertube#soundcloud#translation#video#watch#youtube_video NewPipe is a free, open-source Android app for ad-free streaming and downloading videos/audio from YouTube, SoundCloud, PeerTube and more, with background play, pop-up mode, subscriptions without accounts, and no Google tracking for full privacy. The team is rewriting the code for a modern, stable version—download nightly builds to try new features early. This benefits you by saving data/battery, enabling offline/multitasking use, and protecting your data on any device. https://github.com/TeamNewPipe/NewPipe