Skip to content

VM: extremely slow 'const' in some cases #2530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rakudrama opened this issue Apr 11, 2012 · 4 comments
Closed

VM: extremely slow 'const' in some cases #2530

rakudrama opened this issue Apr 11, 2012 · 4 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@rakudrama
Copy link
Member

A simple looking use of 'const' causes run time to nearly double.

Repro: https://chromiumcodereview.appspot.com/10060002/

Time before:
Started
Compiling minfrog on Dart VM took 11.8 seconds in checked mode + compile all
Compiling minfrog on Dart VM took 1.8 seconds in production mode
./frog/minfrog --out=frog/minfrog frog/minfrog.dart frog/tests/hello.dart
hello world
Bootstrapping minfrog took 3.4 seconds in production mode
Generated production minfrog is 507 kB

Time after:
Started
Compiling minfrog on Dart VM took 19.3 seconds in checked mode + compile all
Compiling minfrog on Dart VM took 3.5 seconds in production mode
./frog/minfrog --out=frog/minfrog frog/minfrog.dart frog/tests/hello.dart
hello world
Bootstrapping minfrog took 3.3 seconds in production mode
Generated production minfrog is 507 kB

@ghost
Copy link

ghost commented Apr 11, 2012

The checked mode gets slower if a vari


Set owner to @sgmitrovic.

@rakudrama
Copy link
Member Author

Changing the test order to test thing === NEWLINE first recovers the performance.

        if (thing === NEWLINE) {
          sb.add('\n');
          pendingIndent = true;
        } else if (thing is String) {
          if (pendingIndent) {
            for (int i = 0; i < indentation; i++) {
              sb.add(INDENTATION);
            }
            pendingIndent = false;
          }
          sb.add(thing);
        } else

What this means is that the (x is String) test is very slow - O(100k) instructions when x is some random class.

@ghost
Copy link

ghost commented Apr 12, 2012

Fixed in r6445


Added Fixed label.

@rakudrama
Copy link
Member Author

Added Verified label.

@rakudrama rakudrama added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. labels Apr 12, 2012
@rakudrama rakudrama assigned ghost Apr 12, 2012
dart-bot pushed a commit that referenced this issue Jul 20, 2020
git log --oneline 85bdb898aeb2ac7cea76489ba0bf4e52ff7a79bf..master
04b054b6 Find sdk path with cli_util (#2567)
36c195b9 Only alert about new prereleases for prereleases (#2556)
00b36394 Stop using deprecated mapMap from pkg:collection (#2544)
477cbe72 Improved expectations in flutter_plugin_format validator test (#2532)
a8e2442b `pub run` Don't write about precompilation if no terminal is attached (#2531)
d83d36a4 Don't precompile dependencies of global activate from path (#2530)
870f395c Sanitize git cache folder names (#2522)
03b7f9a5 Avoid divisive terms (#2523)
b239ada4 Remove divisive term (#2517)

Change-Id: I55ea52a86121a382dca5c0f85addd4513ada50bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154940
Reviewed-by: Jonas Jensen <[email protected]>
Commit-Queue: Sigurd Meldgaard <[email protected]>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

1 participant