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

Резултати

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

Пребарај: #charts

当前筛选 #charts清除筛选
Bts.bighitofficial

@OUR_7_PRINCES · Post #114824 · 23.07.2025 г., 09:24

BTS’ “Permission To Dance On Stage - Live” becomes the First Live Album by an Asian Act to enter the Top 10 of the Worldwide Apple Music Album Charts! CONGRATULATIONS BTS #CHARTS •@OUR_7_PRINCES•

Hashtags

Bts.bighitofficial

@OUR_7_PRINCES · Post #115015 · 30.07.2025 г., 19:09

“Dynamite” has surpassed 2.1 billion streams on Spotify, BTS's first song to do so! Congratulations bts 💜 Let's get that 2B for the MV too. https://youtu.be/gdZLi9oWNZg?si=MK1oUNrKA-X2B0S0 #CHARTS | #SPOTIFY •@OUR_7_PRINCES•

Bts.bighitofficial

@OUR_7_PRINCES · Post #114720 · 19.07.2025 г., 17:37

📊| @/BTS_twt's “PERMISSION TO DANCE ON STAGE – LIVE” (14.5M) breaks the record as the BIGGEST DEBUT for a live album in spotify's HISTORY, surpassing Beyonce ‘Homecoming: The Live Album’ (8.5)! CONGRATULATIONS BTS RECORD MAKER BTS BTS GREATEST OF ALL TIME #CHARTS | #SPOTIFY •@OUR_7_PRINCES•

Bts.bighitofficial

@OUR_7_PRINCES · Post #114700 · 18.07.2025 г., 10:12

🌍| #PTD_ON_THE_STAGE_LIVE album on itunes — #1. Australia #1. Austria #1. Brazil #1. France #1. India #1. Philippines #1. Spain — 7 #1 around the world so far! Apple Music : https://music.apple.com/in/album/permission-to-dance-on-stage-live/1823627665 Spotify link : https://open.spotify.com/album/7xLhqoM0ilHRKUg2irVSDI?si=VaQHZroSQY2V7tdhnz0oeg #CHARTS | #iTUNES •@OUR_7_PRINCES•

GitHub Trends

@githubtrending · Post #14942 · 10.07.2025 г., 13:30

#go#chart#charts#cncf#helm#kubernetes Helm is a tool that helps manage applications on Kubernetes. It simplifies deploying and managing apps by using pre-configured packages called Helm Charts. These charts include all the necessary resources for an application, making it easy to install, update, or remove apps with just a few commands. This saves time and reduces errors, as you only need to edit a single file to change settings across different environments. Using Helm boosts productivity and makes deploying complex applications much easier. https://github.com/helm/helm

GitHub Trends

@githubtrending · Post #15384 · 02.01.2026 г., 12:00

#other#awesome#chartjs#charts#integrations#plugins#resources Chart.js is a flexible JavaScript library for creating interactive charts with extensive customization options. You can use it with popular frameworks like React, Vue, and Angular through dedicated adapters, and extend its functionality with plugins for styling, features, and data handling. The library supports three major versions—v2 (April 2016), v3 (April 2021), and v4 (November 2022)—each with different plugin compatibility. This means you can choose the version that best fits your project needs and find compatible extensions for charts, animations, zooming, data labels, and more. Whether you need basic charts or advanced visualizations with custom interactions, Chart.js provides the tools to build professional data displays efficiently. https://github.com/chartjs/awesome

GitHub Trends

@githubtrending · Post #14626 · 23.04.2025 г., 13:00

#typescript#charts#data_grid#data_table#date_picker#date_range_picker#hacktoberfest#react#time_picker MUI X provides advanced React components like Data Grids, Date Pickers, Charts, and Tree Views for building data-rich apps, offering free MIT-licensed tools for basic needs and paid Pro/Premium plans with advanced features like server-side data handling and AI assistance, saving development time with ready-made solutions while allowing customization for any design system[1][2][4]. https://github.com/mui/mui-x