File: parse.yaml

package info (click to toggle)
ruby-csv 3.3.5-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 796 kB
  • sloc: ruby: 6,862; makefile: 4; sh: 4
file content (32 lines) | stat: -rw-r--r-- 1,130 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
loop_count: 100
contexts:
  - gems:
      csv: 3.0.1
  - gems:
      csv: 3.0.2
  - gems:
      csv: 3.3.0
  - name: "master"
    prelude: |
      $LOAD_PATH.unshift(File.expand_path("lib"))
      require "csv"
prelude: |-
  n_columns = Integer(ENV.fetch("N_COLUMNS", "50"), 10)
  n_rows = Integer(ENV.fetch("N_ROWS", "1000"), 10)
  alphas = ["AAAAA"] * n_columns
  unquoted = (alphas.join(",") + "\r\n") * n_rows
  quoted = (alphas.map { |s| %("#{s}") }.join(",") + "\r\n") * n_rows
  mixed = (alphas.map.with_index { |s, i| i.odd? ? s : %("#{s}") }.join(",") + "\r\n") * n_rows
  inc_col_sep = (alphas.map { |s| %(",#{s}") }.join(",") + "\r\n") * n_rows
  inc_row_sep = (alphas.map { |s| %("#{s}\r\n") }.join(",") + "\r\n") * n_rows
  hiraganas = ["あああああ"] * n_columns
  enc_utf8 = (hiraganas.join(",") + "\r\n") * n_rows
  enc_sjis = enc_utf8.encode("Windows-31J")
benchmark:
  unquoted: CSV.parse(unquoted)
  quoted: CSV.parse(quoted)
  mixed: CSV.parse(mixed)
  include_col_sep: CSV.parse(inc_col_sep)
  include_row_sep: CSV.parse(inc_row_sep)
  encode_utf-8: CSV.parse(enc_utf8)
  encode_sjis: CSV.parse(enc_sjis)