github.com/maruel/nin@v0.0.0-20220112143044-f35891e3ce7e/compare_against_ninja.sh (about)

     1  #!/bin/bash
     2  # Copyright 2021 Google LLC
     3  #
     4  # Licensed under the Apache License, Version 2.0 (the "License");
     5  # you may not use this file except in compliance with the License.
     6  # You may obtain a copy of the License at
     7  #
     8  #      http://www.apache.org/licenses/LICENSE-2.0
     9  #
    10  # Unless required by applicable law or agreed to in writing, software
    11  # distributed under the License is distributed on an "AS IS" BASIS,
    12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  # See the License for the specific language governing permissions and
    14  # limitations under the License.
    15  
    16  set -eu
    17  
    18  # Disable __pycache__.
    19  export PYTHONDONTWRITEBYTECODE=x
    20  
    21  if [ ! -f ./ninja ]; then
    22    python3 ./configure.py --bootstrap
    23  fi
    24  
    25  # Make sure re2c is compiled before, otherwise it will affect the first run.
    26  ./regen.sh
    27  
    28  echo "Building ninja_test from scratch with both ninja and nin."
    29  echo ""
    30  echo "./ninja --quiet -d stats ninja_test"
    31  rm -rf build ninja_test
    32  time ./ninja --quiet -d stats ninja_test
    33  
    34  echo ""
    35  echo "nin --quiet -d stats ninja_test"
    36  rm -rf build ninja_test
    37  go install ./cmd/nin
    38  time nin --quiet -d stats ninja_test
    39  
    40  # Build the remaining performance tests.
    41  ./ninja --quiet build_log_perftest depfile_parser_perftest manifest_parser_perftest
    42  
    43  echo ""
    44  echo "Comparing build_log_perftest:"
    45  echo "C++"
    46  ./build_log_perftest
    47  echo "Go"
    48  go run ./cmd/build_log_perftest
    49  
    50  # TODO(maruel): Either commit or generate a .d file.
    51  #echo ""
    52  #echo "Comparing depfile_parser_perftest:"
    53  #echo "C++"
    54  #./depfile_parser_perftest
    55  #echo "Go"
    56  #go run ./cmd/depfile_parser_perftest
    57  
    58  echo ""
    59  echo "Comparing manifest_parser_perftest:"
    60  echo "C++"
    61  ./manifest_parser_perftest
    62  echo "Go"
    63  go run ./cmd/manifest_parser_perftest