<commit_before>//===--- DataBenchmarks.swift ---------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//

import TestsUtils
import Foundation

let d: [BenchmarkCategory] =  [.validation, .api, .Data]
let skip: [BenchmarkCategory] = [.validation, .api, .Data, .skip]

public let DataBenchmarks = [
  BenchmarkInfo(name: "DataCreateEmpty",
    runFunction: run_createEmpty, tags: d),
  BenchmarkInfo(name: "DataCreateSmall",
    runFunction: run_createSmall, tags: d),
  BenchmarkInfo(name: "DataCreateMedium",
    runFunction: run_createMedium, tags: d),
  BenchmarkInfo(name: "DataCreateLarge",
    runFunction: run_createLarge, tags: skip),

  BenchmarkInfo(name: "DataCreateEmptyArray",
    runFunction: run_createEmptyArray, tags: d),
  BenchmarkInfo(name: "DataCreateSmallArray",
    runFunction: run_createSmallArray, tags: d),
  BenchmarkInfo(name: "DataCreateMediumArray",
    runFunction: run_createMediumArray, tags: d),

  BenchmarkInfo(name: "DataSubscriptSmall",
    runFunction: run_SubscriptSmall, tags: d),
  BenchmarkInfo(name: "DataSubscriptMedium",
    runFunction: run_SubscriptMedium, tags: d),
  BenchmarkInfo(name: "DataSubscriptLarge",
    runFunction: run_SubscriptLarge, tags: skip),

  BenchmarkInfo(name: "DataCountSmall",
    runFunction: run_CountSmall, tags: d),
  BenchmarkInfo(name: "DataCountMedium",
    runFunction: run_CountMedium, tags: d),
  BenchmarkInfo(name: "DataCountLarge",
    runFunction: run_CountLarge, tags: skip),

  BenchmarkInfo(name: "DataSetCountSmall",
    runFunction: run_SetCountSmall, tags: d),
  BenchmarkInfo(name: "DataSetCountMedium",
    runFunction: run_SetCountMedium, tags: d),
  BenchmarkInfo(name: "DataSetCountLarge",
    runFunction: run_SetCountLarge, tags: skip),

  BenchmarkInfo(name: "DataAccessBytesSmall",
    runFunction: run_AccessBytesSmall, tags: d),
  BenchmarkInfo(name: "DataAccessBytesMedium",
    runFunction: run_AccessBytesMedium, tags: d),
  BenchmarkInfo(name: "DataAccessBytesLarge",
    runFunction: run_AccessBytesLarge, tags: skip),

  BenchmarkInfo(name: "DataMutateBytesSmall",
    runFunction: run_MutateBytesSmall, tags: d),
  BenchmarkInfo(name: "DataMutateBytesMedium",
    runFunction: run_MutateBytesMedium, tags: d),
  BenchmarkInfo(name: "DataMutateBytesLarge",
    runFunction: run_MutateBytesLarge, tags: skip),

  BenchmarkInfo(name: "DataCopyBytesSmall",
    runFunction: run_CopyBytesSmall, tags: d),
  BenchmarkInfo(name: "DataCopyBytesMedium",
    runFunction: run_CopyBytesMedium, tags: d),
  BenchmarkInfo(name: "DataCopyBytesLarge",
    runFunction: run_CopyBytesLarge, tags: skip),

  BenchmarkInfo(name: "DataAppendBytesSmall",
    runFunction: run_AppendBytesSmall, tags: d),
  BenchmarkInfo(name: "DataAppendBytesMedium",
    runFunction: run_AppendBytesMedium, tags: d),
  BenchmarkInfo(name: "DataAppendBytesLarge",
    runFunction: run_AppendBytesLarge, tags: skip),

  BenchmarkInfo(name: "DataAppendArray",
    runFunction: run_AppendArray, tags: d),

  BenchmarkInfo(name: "DataReset",
    runFunction: run_Reset, tags: d),

  BenchmarkInfo(name: "DataReplaceSmall",
    runFunction: run_ReplaceSmall, tags: d),
  BenchmarkInfo(name: "DataReplaceMedium",
    runFunction: run_ReplaceMedium, tags: d),
  BenchmarkInfo(name: "DataReplaceLarge",
    runFunction: run_ReplaceLarge, tags: d),

  BenchmarkInfo(name: "DataReplaceSmallBuffer",
    runFunction: run_ReplaceSmallBuffer, tags: d),
  BenchmarkInfo(name: "DataReplaceMediumBuffer",
    runFunction: run_ReplaceMediumBuffer, tags: d),
  BenchmarkInfo(name: "DataReplaceLargeBuffer",
    runFunction: run_ReplaceLargeBuffer, tags: skip),

  BenchmarkInfo(name: "DataAppendSequence",
    runFunction: run_AppendSequence, tags: d),

  BenchmarkInfo(name: "DataAppendDataSmallToSmall",
    runFunction: run_AppendDataSmallToSmall, tags: d),
  BenchmarkInfo(name: "DataAppendDataSmallToMedium",
    runFunction: run_AppendDataSmallToMedium, tags: d),
  BenchmarkInfo(name: "DataAppendDataSmallToLarge",
    runFunction: run_AppendDataSmallToLarge, tags: d),
  BenchmarkInfo(name: "DataAppendDataMediumToSmall",
    runFunction: run_AppendDataMediumToSmall, tags: d),
  BenchmarkInfo(name: "DataAppendDataMediumToMedium",
    runFunction: run_AppendDataMediumToMedium, tags: d),
  BenchmarkInfo(name: "DataAppendDataMediumToLarge",
    runFunction: run_AppendDataMediumToLarge, tags: skip),
  BenchmarkInfo(name: "DataAppendDataLargeToSmall",
    runFunction: run_AppendDataLargeToSmall, tags: d),
  BenchmarkInfo(name: "DataAppendDataLargeToMedium",
    runFunction: run_AppendDataLargeToMedium, tags: d),
  BenchmarkInfo(name: "DataAppendDataLargeToLarge",
    runFunction: run_AppendDataLargeToLarge, tags: skip),

  BenchmarkInfo(name: "DataToStringEmpty",
    runFunction: run_DataToStringEmpty, tags: d, legacyFactor: 50),
  BenchmarkInfo(name: "DataToStringSmall",
    runFunction: run_DataToStringSmall, tags: d, legacyFactor: 50),
  BenchmarkInfo(name: "DataToStringMedium",
    runFunction: run_DataToStringMedium, tags: d, legacyFactor: 50),

  BenchmarkInfo(name: "StringToDataEmpty",
    runFunction: run_StringToDataEmpty, tags: d, legacyFactor: 50),
  BenchmarkInfo(name: "StringToDataSmall",
    runFunction: run_StringToDataSmall, tags: d, legacyFactor: 50),
  BenchmarkInfo(name: "StringToDataMedium",
    runFunction: run_StringToDataMedium, tags: d, legacyFactor: 50),
]

enum SampleKind {
  case small
  case medium
  case large
  case veryLarge
  case immutableBacking
}
<commit_msg>[benchmark] Data workload variables<commit_after>//===--- DataBenchmarks.swift ---------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//

import TestsUtils
import Foundation

let d: [BenchmarkCategory] =  [.validation, .api, .Data]
let skip: [BenchmarkCategory] = [.validation, .api, .Data, .skip]

public let DataBenchmarks = [
  BenchmarkInfo(name: "DataCreateEmpty",
    runFunction: run_createEmpty, tags: d),
  BenchmarkInfo(name: "DataCreateSmall",
    runFunction: run_createSmall, tags: d),
  BenchmarkInfo(name: "DataCreateMedium",
    runFunction: run_createMedium, tags: d),
  BenchmarkInfo(name: "DataCreateLarge",
    runFunction: run_createLarge, tags: skip),

  BenchmarkInfo(name: "DataCreateEmptyArray",
    runFunction: run_createEmptyArray, tags: d),
  BenchmarkInfo(name: "DataCreateSmallArray",
    runFunction: run_createSmallArray, tags: d),
  BenchmarkInfo(name: "DataCreateMediumArray",
    runFunction: run_createMediumArray, tags: d),

  BenchmarkInfo(name: "DataSubscriptSmall",
    runFunction: run_SubscriptSmall, tags: d),
  BenchmarkInfo(name: "DataSubscriptMedium",
    runFunction: run_SubscriptMedium, tags: d),
  BenchmarkInfo(name: "DataSubscriptLarge",
    runFunction: run_SubscriptLarge, tags: skip),

  BenchmarkInfo(name: "DataCountSmall",
    runFunction: run_CountSmall, tags: d),
  BenchmarkInfo(name: "DataCountMedium",
    runFunction: run_CountMedium, tags: d),
  BenchmarkInfo(name: "DataCountLarge",
    runFunction: run_CountLarge, tags: skip),

  BenchmarkInfo(name: "DataSetCountSmall",
    runFunction: run_SetCountSmall, tags: d),
  BenchmarkInfo(name: "DataSetCountMedium",
    runFunction: run_SetCountMedium, tags: d),
  BenchmarkInfo(name: "DataSetCountLarge",
    runFunction: run_SetCountLarge, tags: skip),

  BenchmarkInfo(name: "DataAccessBytesSmall",
    runFunction: run_AccessBytesSmall, tags: d),
  BenchmarkInfo(name: "DataAccessBytesMedium",
    runFunction: run_AccessBytesMedium, tags: d),
  BenchmarkInfo(name: "DataAccessBytesLarge",
    runFunction: run_AccessBytesLarge, tags: skip),

  BenchmarkInfo(name: "DataMutateBytesSmall",
    runFunction: run_MutateBytesSmall, tags: d),
  BenchmarkInfo(name: "DataMutateBytesMedium",
    runFunction: run_MutateBytesMedium, tags: d),
  BenchmarkInfo(name: "DataMutateBytesLarge",
    runFunction: run_MutateBytesLarge, tags: skip),

  BenchmarkInfo(name: "DataCopyBytesSmall",
    runFunction: run_CopyBytesSmall, tags: d),
  BenchmarkInfo(name: "DataCopyBytesMedium",
    runFunction: run_CopyBytesMedium, tags: d),
  BenchmarkInfo(name: "DataCopyBytesLarge",
    runFunction: run_CopyBytesLarge, tags: skip),

  BenchmarkInfo(name: "DataAppendBytesSmall",
    runFunction: run_AppendBytesSmall, tags: d),
  BenchmarkInfo(name: "DataAppendBytesMedium",
    runFunction: run_AppendBytesMedium, tags: d),
  BenchmarkInfo(name: "DataAppendBytesLarge",
    runFunction: run_AppendBytesLarge, tags: skip),

  BenchmarkInfo(name: "DataAppendArray",
    runFunction: run_AppendArray, tags: d),

  BenchmarkInfo(name: "DataReset",
    runFunction: run_Reset, tags: d),

  BenchmarkInfo(name: "DataReplaceSmall",
    runFunction: run_ReplaceSmall, tags: d),
  BenchmarkInfo(name: "DataReplaceMedium",
    runFunction: run_ReplaceMedium, tags: d),
  BenchmarkInfo(name: "DataReplaceLarge",
    runFunction: run_ReplaceLarge, tags: d),

  BenchmarkInfo(name: "DataReplaceSmallBuffer",
    runFunction: run_ReplaceSmallBuffer, tags: d),
  BenchmarkInfo(name: "DataReplaceMediumBuffer",
    runFunction: run_ReplaceMediumBuffer, tags: d),
  BenchmarkInfo(name: "DataReplaceLargeBuffer",
    runFunction: run_ReplaceLargeBuffer, tags: skip),

  BenchmarkInfo(name: "DataAppendSequence",
    runFunction: run_AppendSequence, tags: d),

  BenchmarkInfo(name: "DataAppendDataSmallToSmall",
    runFunction: run_AppendDataSmallToSmall, tags: d),
  BenchmarkInfo(name: "DataAppendDataSmallToMedium",
    runFunction: run_AppendDataSmallToMedium, tags: d),
  BenchmarkInfo(name: "DataAppendDataSmallToLarge",
    runFunction: run_AppendDataSmallToLarge, tags: d),
  BenchmarkInfo(name: "DataAppendDataMediumToSmall",
    runFunction: run_AppendDataMediumToSmall, tags: d),
  BenchmarkInfo(name: "DataAppendDataMediumToMedium",
    runFunction: run_AppendDataMediumToMedium, tags: d),
  BenchmarkInfo(name: "DataAppendDataMediumToLarge",
    runFunction: run_AppendDataMediumToLarge, tags: skip),
  BenchmarkInfo(name: "DataAppendDataLargeToSmall",
    runFunction: run_AppendDataLargeToSmall, tags: d),
  BenchmarkInfo(name: "DataAppendDataLargeToMedium",
    runFunction: run_AppendDataLargeToMedium, tags: d),
  BenchmarkInfo(name: "DataAppendDataLargeToLarge",
    runFunction: run_AppendDataLargeToLarge, tags: skip),

  BenchmarkInfo(name: "DataToStringEmpty",
    runFunction: run_DataToStringEmpty, tags: d, legacyFactor: 50),
  BenchmarkInfo(name: "DataToStringSmall",
    runFunction: run_DataToStringSmall, tags: d, legacyFactor: 50),
  BenchmarkInfo(name: "DataToStringMedium",
    runFunction: run_DataToStringMedium, tags: d, legacyFactor: 50),

  BenchmarkInfo(name: "StringToDataEmpty",
    runFunction: run_StringToDataEmpty, tags: d, legacyFactor: 50),
  BenchmarkInfo(name: "StringToDataSmall",
    runFunction: run_StringToDataSmall, tags: d, legacyFactor: 50),
  BenchmarkInfo(name: "StringToDataMedium",
    runFunction: run_StringToDataMedium, tags: d, legacyFactor: 50),
]

let small = sampleData(.small)
let medium = sampleData(.medium)
let large = sampleData(.large)

enum SampleKind {
  case small
  case medium
  case large
  case veryLarge
  case immutableBacking
}

{'fraction_non_alphanumeric': 0.12504190412336574, 'fraction_numerical': 0.0036875628561850488, 'mean_word_length': 5.340595111583422, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4430869', 'n_tokens_mistral': 3835, 'n_tokens_neox': 3673, 'n_words': 818}