+ 4
Anyone can make a comparing list for functions perf?
For example I know that use a "for" is faster that "foreach" but I don't know about "while". By the way I'm sure it has many tips like that to improve perfs, if anyone could make a list to compare perfs for common functions :3
15 Answers
+ 19
Here's the code:
https://code.sololearn.com/c7ym5RYOQeL2/?ref=app
+ 15
@Shawn You're welcome. May the jvm be with you ^^
+ 14
well alright then. Thank you it's been a long day and I have to say that you have made my day
+ 14
thank you it's been a long day but you have help considerably
+ 14
thanks I hope so btw what's. jvm
+ 13
I don't know exactly, but I execute performance tests in debug mode of the ide. I would write loops with exactly the same conditions, increments and inner statements and let it run a looooot of iterations. Debug mode gives you start and end times (could need a plugin for that, another way is to output system time of start/end).
+ 13
I've tried to save the code not sure if it is saved . don't know what I'm doing really
+ 13
@Shawn
Go to your profile and then to 'Codes' on the left. This is where you find your saved codes.
+ 13
@Geoffrey Yeah, that was a really bad one ^^
+ 11
I could compare the loop's time with and without if statements. Comparing if to a loop would take as many ifs as iterations.
But later, have to work first ^^
+ 11
@Shawn Java virtual machine, see
https://en.m.wikipedia.org/wiki/Java_virtual_machine
Don't mind, it was just a bad joke.
+ 2
@Tashi You are a true geek :0 "J.V.M be with you" omg! xD
+ 1
@Tashi Great! thanks.
+ 1
Since I don't know Java could you implement in your test, functions like: swicth/if/shortcuted if (blabla)? blabla:blabla; (forgot the name of this simple if)
+ 1
Sure! me too, preparing to go to work right now...and still typing on Sololearn... this kind people :0