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

Резултати

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

Пребарај: #launch

当前筛选 #launch清除筛选
SpaceX

@SpaceX · Post #10307 · 14.02.2024 г., 18:58

🚀Next launchStarlinkGroup7-14 RocketFalcon9Block5 FromSLC-4E,VandenbergSFB🇺🇸 🕙Launch time February 15th, 01:34 UTC🆕 🌍Mission information TypeCommunications OrbitLowEarthOrbit 🚀Vehicle information CoreB1082.2(2ndflight♻️) LandingOCISLY(ASDS🌊) ℹ️ A batch of 22 satellites for the Starlink mega-constellation - SpaceX's project for space-based Internet communication system. #Launch

Hashtags

SpaceX

@SpaceX · Post #10306 · 14.02.2024 г., 18:33

🚀Next launchUSSF-124 RocketFalcon9Block5 FromSLC-40,CapeCanaveral🇺🇸 🕙Launch time February14th,22:30UTC 🌍Mission information TypeGovernment/TopSecret OrbitLowEarthOrbit 🚀Vehicle information CoreB1078.7(7thflight♻️) LandingLZ-2(RTLS) ℹ️ 2 satellites, one by L3Harris and the other by Northrop Grumman, will be launched as the Hypersonic and Ballistic Tracking Space Sensor (HBTSS) mission for the US Missile Defense Agency. These satellites have improved sensitivity to detect and track hypersonic missiles with fainter signatures. #Launch

Hashtags

SpaceX

@SpaceX · Post #10290 · 12.02.2024 г., 23:47

🚀Next launchNova-CIM-1 RocketFalcon9Block5 FromLC-39A,KennedySpaceCenter🇺🇸 🕙Launch time February15th,06:05 UTC 🆕 🌍Mission information TypeLunarExploration OrbitLunarOrbit 🚀Vehicle information CoreB1060.18(18thflight♻️) LandingLZ-1(RTLS) ℹ️ This is the first flight of Nova-C lander which was developed by Intuitive Machines. This mission is a part of CLPS program and carries various NASA payloads in support of Artemis lunar program, as well as multiple commercial payloads. #Launch

Hashtags

SpaceX

@SpaceX · Post #10130 · 29.12.2023 г., 01:38

🚀Next launchStarlinkGroup6-36 RocketFalcon9Block5 FromSLC-40,CapeCanaveral🇺🇸 🕙Launch time December29th,04:01UTC 🌍Mission information TypeCommunications OrbitLowEarthOrbit 🚀Vehicle information CoreB1069.12 (12thflight♻️) LandingASOG(ASDS🌊) ℹ️ A batch of satellites for the Starlink mega-constellation. #Launch

Hashtags

SpaceX

@SpaceX · Post #10119 · 27.12.2023 г., 14:34

🚀Next launchOTV-7(X-37B)(USSF-52) RocketFalconHeavy FromLC-39A,KennedySpaceCenter🇺🇸 🕙Launch time December29th,01:07UTC 🌍Mission information TypeGovernment/TopSecret OrbitUnknown 🚀Vehicle information CoreB1084.1(1stflight🌟) ExpendableLastflight🌠 Boosters B1064.5(♻️x4) (RTLS: LZ-1) B1065.5(♻️x4) (RTLS: LZ-2) ℹ️ It is the seventh flight of the 📷X-37B program. United States Air Force Orbital Test Vehicle is built by Boeing. #Launch

Hashtags

SpaceX

@SpaceX · Post #10075 · 23.12.2023 г., 11:34

🚀Next launchSARah2&3 RocketFalcon9Block5 FromSLC-4E,VandenbergSFB🇺🇸 🕙Launch time December24th, 13:11UTC🆕 🌍Mission information TypeGovernment/TopSecret OrbitPolarOrbit 🚀Vehicle information CoreB1075.8 (8thflight♻️) LandingLZ-4(RTLS) ℹ️ SARah 2 & 3 are two passive reflector antenna radar satellites built by OHB-System, based on the reflector-antenna technology of SAR-Lupe. They are part of the three satellite constellation being built for the German government as a follow-up to the SAR-Lupe radar sat constellation. #Launch

Hashtags

SpaceX

@SpaceX · Post #10036 · 18.12.2023 г., 18:02

🚀Next launchStarlinkGroup6-34 RocketFalcon9Block5 FromSLC-40,CapeCanaveral🇺🇸 🕙Launch time December19th,04:01UTC 🆕 🌍Mission information TypeCommunications OrbitLowEarthOrbit 🚀Vehicle information CoreB1081.3(3rdflight♻️) LandingASOG(ASDS🌊) ℹ️ A batch of satellites for the Starlink mega-constellation. #Launch

Hashtags

SpaceX

@SpaceX · Post #10030 · 12.12.2023 г., 01:30

🚀Next launchStarlinkGroup6-34 RocketFalcon9Block5 FromSLC-40,CapeCanaveral🇺🇸 🕙Launch time December 13th, 04:05 UTC🆕 🌍Mission information TypeCommunications OrbitLowEarthOrbit 🚀Vehicle information CoreB1081.3(3rdflight♻️) LandingASOG(ASDS🌊) ℹ️ A batch of satellites for the Starlink mega-constellation #Launch

Hashtags

SpaceX

@SpaceX · Post #10023 · 10.12.2023 г., 00:02

🚀Upcoming launchOTV-7(X-37B)(USSF-52) RocketFalconHeavy FromLC-39A,KennedySpaceCenter🇺🇸 🕙Launch time December 13th, 01:14 UTC🆕 🌍Mission information TypeGovernment/TopSecret OrbitUnknown 🚀Vehicle information CoreB1084.1(1stflight🌟) ExpendableLastflight🌠 Boosters B1064.5(♻️x4) (RTLS: LZ-1) B1065.5(♻️x4) (RTLS: LZ-2) ℹ️ It is the seventh flight of the 📷X-37B program. United States Air Force Orbital Test Vehicle is built by Boeing. #Launch

Hashtags

SpaceX

@SpaceX · Post #10021 · 06.12.2023 г., 10:01

🚀Next launchStarlinkGroup6-33 RocketFalcon9Block5 FromSLC-40,CapeCanaveral🇺🇸 🕙Launch time December7th,04:01UTC 🌍Mission information TypeCommunications OrbitLowEarthOrbit 🚀Vehicle information CoreB1077.9(9thflight♻️) LandingJRTI(ASDS🌊) ℹ️ A batch of 23 satellites for the Starlink mega-constellation. #Launch

Hashtags

SpaceX

@SpaceX · Post #10011 · 02.12.2023 г., 20:30

🚀Next launchStarlinkGroup6-31 RocketFalcon9Block5 FromSLC-40,CapeCanaveral🇺🇸 🕙Launch time December3rd,04:00UTC 🌍Mission information TypeCommunications OrbitLowEarthOrbit 🚀Vehicle information CoreB1078.6(6thflight♻️) LandingASOG(ASDS🌊) ℹ️ A batch of satellites for the Starlink mega-constellation #Launch

Hashtags

SpaceX

@SpaceX · Post #9997 · 01.12.2023 г., 00:10

🚀Next launch425ProjectFlight1andothers RocketFalcon9Block5 FromSLC-4E,VandenbergSFB🇺🇸 🕙Launch time December1st,18:19 UTC 🆕 🌍Mission information TypeGovernment/TopSecret OrbitSun-SynchronousOrbit 🚀Vehicle information CoreB1061.17(17thflight♻) LandingLZ-4(RTLS) ℹ️ Note: Name of payload is provisional. First launch of an ultimately 5 reconnaissance satellites for the South Korean Defense Acquisition Program Administration (DAPA), with 1 satellite featuring an electro-optical infrared (EO/IR) telescope. #Launch

Hashtags

123•••67
ПретходнаСтраница 1 од 7Следна