Created
March 31, 2020 14:51
-
-
Save orestesgaolin/a5b4fe117ac305f9aa59269ed8f427b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final time1 = DateTime.now(); | |
for (int i = 0; i < 1000000; i++) { | |
final order = (log(69123.65) / log(10) + 1).floor(); | |
final val = (69123.56 - 215.34) / pow(10, (order - 3)); | |
final fin = val.round(); | |
} | |
final time1end = DateTime.now(); | |
print(time1end.difference(time1)); | |
final time1a = DateTime.now(); | |
for (int i = 0; i < 1000000; i++) { | |
final order = (log(69123.65) / ln10).floor() + 1; | |
final val = (69123.56 - 215.34) / pow(10, (order - 3)); | |
final fin = val.round(); | |
} | |
final time1aend = DateTime.now(); | |
print(time1aend.difference(time1a)); | |
final time2 = DateTime.now(); | |
for (int i = 0; i < 1000000; i++) { | |
final order = 69123.65.toInt().toString().length; | |
final val = (69123.65 - 215.34) / pow(10, (order - 3)); | |
final fin = val.round(); | |
} | |
final time2end = DateTime.now(); | |
print(time2end.difference(time2)); | |
final time3 = DateTime.now(); | |
for (int i = 0; i < 1000000; i++) { | |
final order = 69123.65.toInt().bitLength ~/ 3; | |
final val = (69123.65 - 215.34) / pow(10, (order - 3)); | |
final fin = val.round(); | |
} | |
final time3end = DateTime.now(); | |
print(time3end.difference(time3)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment