0

Please determine which one is faster

Both produces conflicting results. https://code.sololearn.com/c6Ln9yC8uxHT/?ref=app stm or stm2?

28th Jun 2020, 12:14 PM
Tricker
10 odpowiedzi
+ 1
Is this what your trying to do?:- https://code.sololearn.com/c1peDJRS36mu/#py The method of accessing "a called" functions in timeit is shown in the timit module in python.org. I've changed the 'number'. to 1000......so amend as you see fit.
28th Jun 2020, 12:46 PM
rodwynnejones
rodwynnejones - avatar
+ 2
Well, I made this short code for to know the speed of each stm's. https://code.sololearn.com/cwGi9G1ADG4A/?ref=app => stm2 is faster
28th Jun 2020, 12:25 PM
⚡🔥 😎 Baby Hater 🔥⚡
⚡🔥 😎 Baby Hater 🔥⚡ - avatar
+ 2
Tricker I know it, flipping the print functions will nothing happen ;)
28th Jun 2020, 12:33 PM
⚡🔥 😎 Baby Hater 🔥⚡
⚡🔥 😎 Baby Hater 🔥⚡ - avatar
+ 2
(I think).....In your code, your not calling the function(s).....your just declaring/ defining the function 1 million times.
28th Jun 2020, 1:16 PM
rodwynnejones
rodwynnejones - avatar
+ 1
Change in time cause due to memory usage and processor which is changing continously about million times a second
28th Jun 2020, 12:27 PM
Vishal Gupta
Vishal Gupta - avatar
0
Stm 2 is faster as it takes less time
28th Jun 2020, 12:23 PM
Vishal Gupta
Vishal Gupta - avatar
0
Vishal Gupta have you tried to run multiple times?
28th Jun 2020, 12:24 PM
Tricker
0
⚡🔥 😎 Baby Hater 🔥⚡ Though there will be no difference in speed because starting from new line or terminating using semi colon results in same performance.
28th Jun 2020, 12:32 PM
Tricker
0
rodwynnejones Maybe your code shows that compress is faster. But why there's a big difference in time b/w yours and mine even though both code reflect same process. I reckon it's a nerdy insight.
28th Jun 2020, 12:55 PM
Tricker
0
rodwynnejones That's straightforward right I ponder? I have forgotten the basics.😶
28th Jun 2020, 1:31 PM
Tricker