In the 21st century, the Dart compiler is so primitive that it cannot properly compile elementary code for which other compilers generate efficient code?I am ashamed that I use Dart for computing.Dart is completely unsuitable for this purpose.Dart Pad results:Time passed: 0.000, Test 'good': 2.399 msTime passed: 0.003, Test 'bad': 3.8 msTime passed: 0.006, Test 'good': 1.4 msTime passed: 0.008, Test 'bad': 2 msTime passed: 0.010, Test 'good': 1.5 msTime passed: 0.011, Test 'bad': 1.801 msTime passed: 0.013, Test 'good': 0.901 msTime passed: 0.014, Test 'bad': 0.901 msTime passed: 0.015, Test 'good': 0.899 msTime passed: 0.016, Test 'bad': 0.899 msTime passed: 0.017, Test 'good': 1 msTime passed: 0.018, Test 'bad': 0.9 msDart VM results:Time passed: 0.000, Test 'good': 1.731 msTime passed: 0.004, Test 'bad': 159.304 msTime passed: 0.163, Test 'good': 2.185 msTime passed: 0.166, Test 'bad': 156.398 msTime passed: 0.322, Test 'good': 0.614 msTime passed: 0.323, Test 'bad': 156.95 msTime passed: 0.480, Test 'good': 0.696 msTime passed: 0.481, Test 'bad': 157.634 msTime passed: 0.638, Test 'good': 0.687 msTime passed: 0.639, Test 'bad': 157.56 msTime passed: 0.797, Test 'good': 0.728 msTime passed: 0.798, Test 'bad': 157.279 msSource code:void main() {final count = 1000000;final names = ['good', 'bad'];final tests = [_test1, _test2];final sw = Stopwatch();var repeat = 150;sw.start();while (repeat-- > 0) {for (var i = 0; i < tests.length; i++) {final name = names[i];final test = tests[i];final seconds = (sw.elapsedMilliseconds / 1000).toStringAsFixed(3);final title = 'Time passed: $seconds, Test \'$name\'';_measure(title, 1, () => test(count));}}}void _measure(String name, int count, Function() f) {final sw = Stopwatch();sw.start();for (var i = 0; i < count; i++) {f();}sw.stop();final time = sw.elapsedMicroseconds / 1000;print('$name: $time ms');}int add(int x, int y) => x + y;int add2(int Function(int x, int y) f, int x, int y) => f(x, y);void _test1(int count) {for (var i = 0; i < count; i++) {add(1, 2);add(1, 2);add(1, 2);add(1, 2);add(1, 2);add(1, 2);add(1, 2);add(1, 2);add(1, 2);add(1, 2);}}void _test2(int count) {for (var i = 0; i < count; i++) {add2(add, 1, 2);add2(add, 1, 2);add2(add, 1, 2);add2(add, 1, 2);add2(add, 1, 2);add2(add, 1, 2);add2(add, 1, 2);add2(add, 1, 2);add2(add, 1, 2);add2(add, 1, 2);}}Rust programmers use this kind of computation all over the place. This is in case you want to say that this is not actual.But Rust is not Javascript, but they are smart people too (Rust developers).I am very surprised and cannot understand what the Dart developers are doing at work, while other developers are developing normal compilers for normal calculations.Sorry to be rude, but how is this possible in 2021?--
For more ways to connect visit https://dart.dev/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/5aefa980-54e3-4b39-8d0f-3361a2147a56n%40dartlang.org.
I restructured the benchmark to have a consistent run-time and be proof against dead-code elimination.There is a significant difference in the two calls. (Like 2000 ops/us vs 50 ops/us on the VM)
Sorry for the spam.But I was surprised to learn that this approach is now quite popular in Rust (as well as in Rust itself).Make it as simple as possible. However, this does not mean that many intensive computations will not be done behind the scenes.Again, with the same approach of coding (do code it simple).Hexadecimal color parser:Just a few lines of code. Parser !This parser code can be written on your knees and it will runs very fast.I can (anyone can) implement an approach like this (style, call it whatever you want). It is very easy.But not шт Dart. Dart is ungodly slow for that.Unlike modern JS, Rust and other compilers .My hands are discouraged from such events.четверг, 10 июня 2021 г. в 15:54:36 UTC+5, Andrew Mezoni:This is obsolete code and not correct.Don't refer to it, please.Correct issue as below.void _test2(int count) {final sumIt = sum(add);
for (var i = 0; i < count; i++) {
sumIt(1, 2);}}int Function(int, int) sum(int Function(int, int) f) {return (x, y) {return x + y + f(x, y);};}The "addition" operation is just for example. In fact, the computations are more intensive.But not in one place. Constantly calling code like this.final digits = many(digitParserFunc); // Run oncefinal d = digits(input); // Run many timesчетверг, 10 июня 2021 г. в 15:40:09 UTC+5, Lasse Reichstein Holst Nielsen:
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/0255f968-2550-4634-8fff-506d1581ca8en%40dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/CAPD5VRsSSQqba-PVSgC%3D5N%2BY4FEUPVTCGaOnmAHYMOmo1yoXqg%40mail.gmail.com.
>> I strongly believe that the manner of communication matters and that we can achieve more if we pay attention to the fact that our public messages are read by other humans.
Yes, I'm rude. And this is a fact.
And I excuse myself in front of everyone for intemperance.
But there is still one well-known fact.
Dart developers ignore the community.
Everyone has known this for a long time.
Will you be pleased when you are ignored?
This is not pleasant for many, but they are well-mannered.
And just, out of decency, they say that everything is fine.
What's good? The fact that developers constantly ignore the wishes of the community?
I don't see anything good in this.
>> I am subscribed to this mailing list in the hopes that I get very important deprecation warnings, important announcements, breaking changes
You are deluded.This is a place for discussion.And here a dead silence has been standing for a long time. No discussion whatsoever.чт, 10 июн. 2021 г. в 11:55, Daniel Varga <dvarg...@gmail.com>:
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/CA%2BTxJqBSv_rTExPaYU9pUu67vuZxHqVrKxNtCbHMAQVj4HWrXw%40mail.gmail.com.
--
For more ways to connect visit https://dart.dev/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/CAAfHsy-zbZBxU8uKtM440mQqKV9Vq3xoaqbQUXQWRoJiae1rBQ%40mail.gmail.com.
Yes, I'm rude. And this is a fact.
And I excuse myself in front of everyone for intemperance.I am sorry, but you are not excused here. You are welcome to post benchmarks and ask questions. You are not welcome to violate our code of conduct: https://dart.dev/code-of-conduct.