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

Резултати

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

Пребарај: #embezzlement

当前筛选 #embezzlement清除筛选
Reuters: World

@reutersworldchannel · Post #149432 · 15.10.2021 г., 21:16

South Carolina lawyer Alex Murdaugh now faces embezzlement charges Alex Murdaugh, a South Carolina lawyer accused of arranging to have himself shot so his son could collect an insurance payout, is facing new charges accusing him of embezzling settlement funds related to the 2018 death of his housekeeper. #AlexMurdaugh#AlexMurdaugh#embezzlement#News#Reuters Subscribe: http://smarturl.it/reuterssubscribe Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled. Get the latest news on: http://reuters.com/ Follow Reuters on Facebook: https://www.facebook.com/Reuters Follow Reuters on Twitter: https://twitter.com/Reuters Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en ➖@reutersworldchannel➖

Crypto M - Crypto News

@CryptoM · Post #65188 · 11.04.2026 г., 17:35

🚀 Federal Reserve Bans Bank Employee for Embezzlement The Federal Reserve has issued a prohibition order against Mollie Morrow, a sales representative at United Bank, following accusations of embezzling $33,136 during the bank's ATM replenishment process. According to NS3.AI, Morrow pleaded guilty to the charges and has been ordered to make full restitution. Additionally, she has agreed to a ban from participating in the affairs of federally insured banks, foreign banks, and their subsidiaries. #FederalReserve#Banking#Embezzlement#UnitedBank#FinancialCrime#Restitution#BankRegulation

Venture Village Wall 🦄

@venturevillagewall · Post #3438 · 19.12.2024 г., 07:06

Major Moves in Tech and AI 🔹Avito acquires two advertising services: AdRiver and Soloway; no deal amount disclosed but estimates range from 0.5-2.5 billion rubles. More on this from RBC. 🔹Perplexity raises $500M at a $9B valuation. The AI startup specializes in delivering prompt answers to users. Previous valuation was at $3B; read more on Bloomberg. 🔹 Formerly known as TuSimple, the self-driving truck company rebrands to CreateAI, focusing on AI for video games after abandoning its trucking ambitions. Article on CNBC. 🔹 Ex-investment director of RUSNANO, Nail Gubaev, under investigation for alleged embezzlement, signs contract with the Ministry of Defense, prompting a suspension of prosecution. Details in Kommersant (link). 🔹 Insights from Smart Ranking show Russia’s medtech market grew 40% in Q3, with companies like Steplife (+258.5%) and Motorika (+190.95%) leading the growth in prosthetics. More info here: Kommersant. 🔹Broadcom reports a 220% revenue rise, solidifying its status as a $1 trillion company amidst soaring chip demand for AI. Read more on Business Insider. #Avito#Advertising#Funding#AI#Perplexity#TuSimple#CreateAI#MedTech#Prosthetics#Broadcom#RevenueGrowth#NVIDIA#Embezzlement#TechNews#Startups#China#MarketTrends#Innovation#Investments#MarketValuation#TechAcquisition