+ 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

20th Mar 2017, 8:40 PM
Geoffrey L
Geoffrey L - avatar
15 Answers
21st Mar 2017, 12:12 AM
Tashi N
Tashi N - avatar
+ 15
@Shawn You're welcome. May the jvm be with you ^^
21st Mar 2017, 7:58 PM
Tashi N
Tashi N - avatar
+ 14
well alright then. Thank you it's been a long day and I have to say that you have made my day
21st Mar 2017, 7:53 PM
Shawn Gillis
Shawn Gillis - avatar
+ 14
thank you it's been a long day but you have help considerably
21st Mar 2017, 7:55 PM
Shawn Gillis
Shawn Gillis - avatar
+ 14
thanks I hope so btw what's. jvm
21st Mar 2017, 8:01 PM
Shawn Gillis
Shawn Gillis - avatar
+ 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).
20th Mar 2017, 10:58 PM
Tashi N
Tashi N - avatar
+ 13
I've tried to save the code not sure if it is saved . don't know what I'm doing really
21st Mar 2017, 7:50 PM
Shawn Gillis
Shawn Gillis - avatar
+ 13
@Shawn Go to your profile and then to 'Codes' on the left. This is where you find your saved codes.
21st Mar 2017, 7:51 PM
Tashi N
Tashi N - avatar
+ 13
@Geoffrey Yeah, that was a really bad one ^^
21st Mar 2017, 8:21 PM
Tashi N
Tashi N - avatar
+ 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 ^^
21st Mar 2017, 6:07 AM
Tashi N
Tashi N - avatar
+ 11
@Shawn Java virtual machine, see https://en.m.wikipedia.org/wiki/Java_virtual_machine Don't mind, it was just a bad joke.
21st Mar 2017, 8:03 PM
Tashi N
Tashi N - avatar
+ 2
@Tashi You are a true geek :0 "J.V.M be with you" omg! xD
21st Mar 2017, 8:19 PM
Geoffrey L
Geoffrey L - avatar
+ 1
@Tashi Great! thanks.
21st Mar 2017, 5:57 AM
Geoffrey L
Geoffrey L - avatar
+ 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)
21st Mar 2017, 6:00 AM
Geoffrey L
Geoffrey L - avatar
+ 1
Sure! me too, preparing to go to work right now...and still typing on Sololearn... this kind people :0
21st Mar 2017, 6:09 AM
Geoffrey L
Geoffrey L - avatar