Files
sdk/pkg/kernel/test/ast_membench.sh
Asger Feldthaus 8bfc4b47c0 Implement canonical name scheme in kernel.
This adds a class CanonicalName that can represent a library, class,
or member.  All references now go through a Reference object, which is
linked to both the AST node and its CanonicalName, so either can be
created first.

dartk now accepts multiple input files:
- If multiple dart files are given, they are all compiled.
- If multiple binaries are given, they are linked together.
Mixed dart and binary input is not supported by dartk.

dartk now has a flag --include-sdk which includes the entire SDK in
the output.  This is so the SDK can be compiled alone and then linked.

Example of compiling separately and then linking:
  dartk foo.dart -o foo.dill
  dartk main.dart -o main.dill
  dartk --include-sdk -o sdk.dill
  dartk main.dill foo.dill sdk.dill --target=vm --link -o program.dill

dartk still has incredibly slow cold start due to the analyzer loading
the dart sdk, so this does not actually speed things up at the moment.

BUG=
R=ahe@google.com, kmillikin@google.com, kustermann@google.com, sigmund@google.com

Review-Url: https://codereview.chromium.org/2665723002 .
2017-02-23 14:12:10 +01:00

19 lines
666 B
Bash
Executable File

#!/bin/sh
testdir=$(dirname $0)
first_input=10
first_output=$(mktemp)
dart --print-metrics $testdir/ast_membench.dart $1 $first_input >/dev/null 2>$first_output
second_input=20
second_output=$(mktemp)
dart --print-metrics $testdir/ast_membench.dart $1 $second_input >/dev/null 2>$second_output
bytes1=$(fgrep 'heap.old.used.max' $first_output | head -n1 | cut -d' ' -f4)
bytes2=$(fgrep 'heap.old.used.max' $second_output | head -n1 | cut -d' ' -f4)
bytes=$(echo "($bytes2 - $bytes1)/($second_input - $first_input)" | bc)
mega_bytes=$(echo "$bytes / 1000000" | bc)
printf "Memory usage = %d B (%2.2f MB)" $bytes $mega_bytes
echo
rm -f $first_output $second_output