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

Резултати

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

Пребарај: #chatgptmatch

当前筛选 #chatgptmatch清除筛选
TON Crypto News

@toncoin_rap · Post #156 · 19.09.2024 г., 14:29

🎧⤴ TON Dating: AI-Powered Compatibility Checks with ChatGPT! TON Dating has become the first dating app to integrate ChatGPT, offering a new feature that analyzes compatibility between users. By clicking on the ChatGPT icon in a profile, the AI examines both users' data to determine their match potential. This move aims to enhance the dating experience within a verified, secure community that rewards user engagement with cryptocurrency. The integration sets TON Dating apart, offering a futuristic, AI-driven approach to finding meaningful connections on the platform. 😴👉https://t.me/tondating Chorus: TON Dating's blowing up, with ChatGPT inside, AI's your new matchmaker, taking love on a ride. Swipe right, swipe left, let the AI decide, Finding true connections where ambition and love collide. Verse 1: Step into the game, TON's raising the stakes, AI compatibility, no more heartbreaks. Profiles verified, no scammers in sight, Pay-to-play, yeah, but it feels just right. Girls roll free, boys paying their dues, Crypto rewards for every match you choose. Swipe with intention, love or coin’s the prize, TON Dating's got the edge, no surprise. Chorus: TON Dating's blowing up, with ChatGPT inside, AI's your new matchmaker, taking love on a ride. Swipe right, swipe left, let the AI decide, Finding true connections where ambition and love collide. Verse 2: Ambition meets beauty, the motto’s legit, Profiles vetted hard, so no catfish hit. Vlad’s got a vision, safe space to thrive, No fake accounts here, just the real ones alive. Stack your TON coin, let your profile shine, The app’s got your back with AI design. Success and smarts, it’s the ultimate find, TON Dating’s got that AI mastermind. Chorus: TON Dating's blowing up, with ChatGPT inside, AI's your new matchmaker, taking love on a ride. Swipe right, swipe left, let the AI decide, Finding true connections where ambition and love collide. Verse 3: Crypto’s the future, and dating’s the key, Bringing people closer through technology. ChatGPT whispers, "Is this love or a game?" It’s matchmaking magic, never quite the same. Filter out the fakes, meet your match on screen, High standards, high hopes in this dating scene. From Telegram to TON, the platform's tight, Find your perfect vibe, under AI light. Chorus: TON Dating's blowing up, with ChatGPT inside, AI's your new matchmaker, taking love on a ride. Swipe right, swipe left, let the AI decide, Finding true connections where ambition and love collide. Bridge: So step up to the future, the game just begun, With ChatGPT matching, you might find "the one." It’s a new world, new rules, tech by your side, TON Dating’s the place where love and crypto collide. #TONDating#AIDating#ChatGPTMatch #TONCryptoNewsRapStyle 🎧@toncoin_rap