parameters: (filename, results)
docstring: Output plain benchmark results
  
      :Parameters:
        `filename` : ``str``
          Filename to write to
  
        `results` : ``list``
          Results
docstring_summary: Output plain benchmark results
docstring_tokens: Output plain benchmark results
function: def write_plain(filename, results):
      """
      Output plain benchmark results
  
      :Parameters:
        `filename` : ``str``
          Filename to write to
  
        `results` : ``list``
          Results
      """
      lines = []
      results = sorted(results, reverse=True)
      for idx, (version, import_notes, result) in enumerate(results):
          if idx:
              lines.append('')
              lines.append('')
  
          lines.append('$ python%s -OO bench/main.py bench/*.js' % (
              '.'.join(version.split('.')[:2])
          ))
          lines.append('~' * 72)
          for note in import_notes:
              lines.append(uni(note))
          lines.append('Python Release: %s' % (version,))
  
          for single in result:
              lines.append('')
              lines.append('Benchmarking %r... (%.1f KiB)' % (
                  uni(single['filename']), single['size'] / 1024.0
              ))
              for msg in single['messages']:
                  lines.append(msg)
              times = []
              space = max([len(uni(port)) for port, _ in single['times']])
              for idx, (port, time) in enumerate(single['times']):
                  port = uni(port)
                  if time is None:
                      lines.append("  FAILED %s" % (port,))
                  else:
                      times.append(time)
                      lines.append(
                          "  Timing %s%s ... (%5.1f KiB %s) %8.2f ms" % (
                              port,
                              " " * (space - len(port)),
                              single['sizes'][idx] / 1024.0,
                              idx == 0 and '*' or ['=', '>', '<'][
                                  cmp(single['sizes'][idx], single['sizes'][0])
                              ],
                              time
                          )
                      )
                      if len(times) > 1:
                          lines[-1] += " (factor: %s)" % (', '.join([
                              '%.2f' % (timed / time) for timed in times[:-1]
                          ]))
  
      lines.append('')
      lines.append('')
      lines.append('# vim: nowrap')
      fp = open(filename, 'w')
      try:
          fp.write('\n'.join(lines) + '\n')
      finally:
          fp.close()
function_tokens: def write_plain ( filename , results ) : lines = [ ] results = sorted ( results , reverse = True ) for idx , ( version , import_notes , result ) in enumerate ( results ) : if idx : lines . append ( '' ) lines . append ( '' ) lines . append ( '$ python%s -OO bench/main.py bench/*.js' % ( '.' . join ( version . split ( '.' ) [ : 2 ] ) ) ) lines . append ( '~' * 72 ) for note in import_notes : lines . append ( uni ( note ) ) lines . append ( 'Python Release: %s' % ( version , ) ) for single in result : lines . append ( '' ) lines . append ( 'Benchmarking %r... (%.1f KiB)' % ( uni ( single [ 'filename' ] ) , single [ 'size' ] / 1024.0 ) ) for msg in single [ 'messages' ] : lines . append ( msg ) times = [ ] space = max ( [ len ( uni ( port ) ) for port , _ in single [ 'times' ] ] ) for idx , ( port , time ) in enumerate ( single [ 'times' ] ) : port = uni ( port ) if time is None : lines . append ( "  FAILED %s" % ( port , ) ) else : times . append ( time ) lines . append ( "  Timing %s%s ... (%5.1f KiB %s) %8.2f ms" % ( port , " " * ( space - len ( port ) ) , single [ 'sizes' ] [ idx ] / 1024.0 , idx == 0 and '*' or [ '=' , '>' , '<' ] [ cmp ( single [ 'sizes' ] [ idx ] , single [ 'sizes' ] [ 0 ] ) ] , time ) ) if len ( times ) > 1 : lines [ - 1 ] += " (factor: %s)" % ( ', ' . join ( [ '%.2f' % ( timed / time ) for timed in times [ : - 1 ] ] ) ) lines . append ( '' ) lines . append ( '' ) lines . append ( '# vim: nowrap' ) fp = open ( filename , 'w' ) try : fp . write ( '\n' . join ( lines ) + '\n' ) finally : fp . close ( )