44#
55# Copyright (c) 2018 The Stdlib Authors.
66#
7- # Licensed under the Apache License, Version 2.0 (the " License" );
7+ # Licensed under the Apache License, Version 2.0 (the ' License' );
88# you may not use this file except in compliance with the License.
99# You may obtain a copy of the License at
1010#
1111# http://www.apache.org/licenses/LICENSE-2.0
1212#
1313# Unless required by applicable law or agreed to in writing, software
14- # distributed under the License is distributed on an " AS IS" BASIS,
14+ # distributed under the License is distributed on an ' AS IS' BASIS,
1515# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1616# See the License for the specific language governing permissions and
1717# limitations under the License.
2020options( digits = 16L );
2121
2222# Temporarily turn off warnings:
23- setting <- getOption( " warn" );
23+ setting <- getOption( ' warn' );
2424options( warn = - 1 );
2525
2626# ' Run benchmarks.
@@ -29,7 +29,7 @@ options( warn = -1 );
2929# ' main();
3030main <- function () {
3131 # Define benchmark parameters:
32- name <- " binomcoef " ;
32+ name <- ' binomcoeff ' ;
3333 iterations <- 10000L ;
3434 repeats <- 3L ;
3535
@@ -38,7 +38,7 @@ main <- function() {
3838 # ' @examples
3939 # ' print_version();
4040 print_version <- function () {
41- cat( " TAP version 13\n " );
41+ cat( ' TAP version 13\n ' );
4242 }
4343
4444 # ' Print the TAP summary.
@@ -49,12 +49,12 @@ main <- function() {
4949 # ' @examples
5050 # ' print_summary( 3, 3 );
5151 print_summary <- function ( total , passing ) {
52- cat( " #\n " );
53- cat( paste0( " 1.." , total , " \n " ) ); # TAP plan
54- cat( paste0( " # total " , total , " \n " ) );
55- cat( paste0( " # pass " , passing , " \n " ) );
56- cat( " #\n " );
57- cat( " # ok\n " );
52+ cat( ' #\n ' );
53+ cat( paste0( ' 1..' , total , ' \n ' ) ); # TAP plan
54+ cat( paste0( ' # total ' , total , ' \n ' ) );
55+ cat( paste0( ' # pass ' , passing , ' \n ' ) );
56+ cat( ' #\n ' );
57+ cat( ' # ok\n ' );
5858 }
5959
6060 # ' Print benchmark results.
@@ -66,18 +66,18 @@ main <- function() {
6666 # ' print_results( 10000L, 0.131009101868 );
6767 print_results <- function ( iterations , elapsed ) {
6868 rate <- iterations / elapsed ;
69- cat( " ---\n " );
70- cat( paste0( " iterations: " , iterations , " \n " ) );
71- cat( paste0( " elapsed: " , elapsed , " \n " ) );
72- cat( paste0( " rate: " , rate , " \n " ) );
73- cat( " ...\n " );
69+ cat( ' ---\n ' );
70+ cat( paste0( ' iterations: ' , iterations , ' \n ' ) );
71+ cat( paste0( ' elapsed: ' , elapsed , ' \n ' ) );
72+ cat( paste0( ' rate: ' , rate , ' \n ' ) );
73+ cat( ' ...\n ' );
7474 }
7575
7676 # ' Run a benchmark.
7777 # '
7878 # ' ## Notes
7979 # '
80- # ' * We compute and return a total " elapsed" time, rather than the minimum
80+ # ' * We compute and return a total ' elapsed' time, rather than the minimum
8181 # ' evaluation time, to match benchmark results in other languages (e.g.,
8282 # ' Python).
8383 # '
@@ -91,7 +91,7 @@ main <- function() {
9191 # Run the benchmarks:
9292 results <- microbenchmark :: microbenchmark( choose( (50.0 * runif(1 ))+ 20.0 , 20.0 * runif(1 ) ), times = iterations );
9393
94- # Sum all the raw timing results to get a total " elapsed" time:
94+ # Sum all the raw timing results to get a total ' elapsed' time:
9595 elapsed <- sum( results $ time );
9696
9797 # Convert the elapsed time from nanoseconds to seconds:
@@ -102,10 +102,10 @@ main <- function() {
102102
103103 print_version();
104104 for ( i in 1 : repeats ) {
105- cat( paste0( " # r::" , name , " \n " ) );
105+ cat( paste0( ' # r::' , name , ' \n ' ) );
106106 elapsed <- benchmark( iterations );
107107 print_results( iterations , elapsed );
108- cat( paste0( " ok " , i , " benchmark finished" , " \n " ) );
108+ cat( paste0( ' ok ' , i , ' benchmark finished' , ' \n ' ) );
109109 }
110110 print_summary( repeats , repeats );
111111}
0 commit comments