<commit_before>//===--- PrimsNonStrongRefAdjacencyList.swift -----------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2018 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
//
//===----------------------------------------------------------------------===//
///
/// \file
///
/// The test implements Prim's algorithm for minimum spanning tree building.
/// http://en.wikipedia.org/wiki/Prim%27s_algorithm
///
/// This class implements array-based heap (priority queue). It is used to store
/// edges from nodes in spanning tree to nodes outside of it. We are interested
/// only in the edges with the smallest costs, so if there are several edges
/// pointing to the same node, we keep only one from them. Thus, it is enough to
/// record this node instead.  We maintain a map (node index in graph)->(node
/// index in heap) to be able to update the heap fast when we add a new node to
/// the tree.
///
/// NOTE: This benchmark purposely internally uses non strong references for its
/// adjacency list instead of integers to test that code path for the various
/// types of weak pointers that we use.
///
//===----------------------------------------------------------------------===//

import TestsUtils

public let PrimsNonStrongRef: [BenchmarkInfo] = ({
    var benchmarks: [BenchmarkInfo] = []
#if false
    // TODO: Stabilize weak benchmark.
    benchmarks.append(BenchmarkInfo(
        name: "Prims.NonStrongRef.Weak",
        runFunction: run_PrimsWeak,
        tags: [.validation, .algorithm],
        setUpFunction: {
          touchGlobalInfo()
          blackHole(weakPrimsState)
        }))
    // TODO: Stabilize weak benchmark.
    benchmarks.append(BenchmarkInfo(
        name: "Prims.NonStrongRef.Weak.ClosureAccess",
        runFunction: run_PrimsWeakClosureAccess,
        tags: [.validation, .algorithm],
        setUpFunction: {
          touchGlobalInfo()
          blackHole(weakPrimsState)
        }))
#endif
    benchmarks.append(BenchmarkInfo(
        name: "Prims.NonStrongRef.UnownedSafe",
        runFunction: run_PrimsUnownedSafe,
        tags: [.validation, .algorithm],
        setUpFunction: {
          touchGlobalInfo()
          blackHole(unownedSafePrimsState)
        }))
    benchmarks.append(BenchmarkInfo(
        name: "Prims.NonStrongRef.UnownedSafe.ClosureAccess",
        runFunction: run_PrimsUnownedSafeClosureAccess,
        tags: [.validation, .algorithm],
        setUpFunction: {
          touchGlobalInfo()
          blackHole(unownedSafePrimsState)
        }))
    benchmarks.append(BenchmarkInfo(
        name: "Prims.NonStrongRef.UnownedUnsafe",
        runFunction: run_PrimsUnownedUnsafe,
        tags: [.validation, .algorithm],
        setUpFunction: {
          touchGlobalInfo()
          blackHole(unownedUnsafePrimsState)
        }))
    benchmarks.append(BenchmarkInfo(
        name: "Prims.NonStrongRef.UnownedUnsafe.ClosureAccess",
        runFunction: run_PrimsUnownedUnsafeClosureAccess,
        tags: [.validation, .algorithm],
        setUpFunction: {
          touchGlobalInfo()
          blackHole(unownedUnsafePrimsState)
        }))
    benchmarks.append(BenchmarkInfo(
        name: "Prims.NonStrongRef.Unmanaged",
        runFunction: run_PrimsUnmanaged,
        tags: [.validation, .algorithm, .api],
        setUpFunction: {
          touchGlobalInfo()
          blackHole(unmanagedPrimsState)
        }))
    benchmarks.append(BenchmarkInfo(
        name: "Prims.NonStrongRef.Unmanaged.ClosureAccess",
        runFunction: run_PrimsUnmanagedClosureAccess,
        tags: [.validation, .algorithm, .api],
        setUpFunction: {
          touchGlobalInfo()
          blackHole(unmanagedPrimsState)
        }))
    benchmarks.append(BenchmarkInfo(
        name: "Prims.NonStrongRef.UnmanagedUGR",
        runFunction: run_PrimsUnmanagedUGR,
        tags: [.validation, .algorithm, .api],
        setUpFunction: {
          touchGlobalInfo()
          blackHole(unmanagedUGRPrimsState)
        }))
    benchmarks.append(BenchmarkInfo(
        name: "Prims.NonStrongRef.UnmanagedUGR.ClosureAccess",
        runFunction: run_PrimsUnmanagedUGRClosureAccess,
        tags: [.validation, .algorithm, .api],
        setUpFunction: {
          touchGlobalInfo()
          blackHole(unmanagedUGRPrimsState)
        }))<commit_msg>[benchmark] Fix names<commit_after>//===--- PrimsNonStrongRefAdjacencyList.swift -----------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2018 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
//
//===----------------------------------------------------------------------===//
///
/// \file
///
/// The test implements Prim's algorithm for minimum spanning tree building.
/// http://en.wikipedia.org/wiki/Prim%27s_algorithm
///
/// This class implements array-based heap (priority queue). It is used to store
/// edges from nodes in spanning tree to nodes outside of it. We are interested
/// only in the edges with the smallest costs, so if there are several edges
/// pointing to the same node, we keep only one from them. Thus, it is enough to
/// record this node instead.  We maintain a map (node index in graph)->(node
/// index in heap) to be able to update the heap fast when we add a new node to
/// the tree.
///
/// NOTE: This benchmark purposely internally uses non strong references for its
/// adjacency list instead of integers to test that code path for the various
/// types of weak pointers that we use.
///
//===----------------------------------------------------------------------===//

import TestsUtils

public let PrimsNonStrongRef: [BenchmarkInfo] = ({
    var benchmarks: [BenchmarkInfo] = []
#if false
    // TODO: Stabilize weak benchmark.
    benchmarks.append(BenchmarkInfo(
        name: "Prims.NonStrongRef.Weak",
        runFunction: run_PrimsWeak,
        tags: [.validation, .algorithm],
        setUpFunction: {
          touchGlobalInfo()
          blackHole(weakPrimsState)
        }))
    // TODO: Stabilize weak benchmark.
    benchmarks.append(BenchmarkInfo(
        name: "Prims.NonStrongRef.Weak.Closure",
        runFunction: run_PrimsWeakClosureAccess,
        tags: [.validation, .algorithm],
        setUpFunction: {
          touchGlobalInfo()
          blackHole(weakPrimsState)
        }))
#endif
    benchmarks.append(BenchmarkInfo(
        name: "Prims.NonStrongRef.UnownedSafe",
        runFunction: run_PrimsUnownedSafe,
        tags: [.validation, .algorithm],
        setUpFunction: {
          touchGlobalInfo()
          blackHole(unownedSafePrimsState)
        }))
    benchmarks.append(BenchmarkInfo(
        name: "Prims.NonStrongRef.UnownedSafe.Closure",
        runFunction: run_PrimsUnownedSafeClosureAccess,
        tags: [.validation, .algorithm],
        setUpFunction: {
          touchGlobalInfo()
          blackHole(unownedSafePrimsState)
        }))
    benchmarks.append(BenchmarkInfo(
        name: "Prims.NonStrongRef.UnownedUnsafe",
        runFunction: run_PrimsUnownedUnsafe,
        tags: [.validation, .algorithm],
        setUpFunction: {
          touchGlobalInfo()
          blackHole(unownedUnsafePrimsState)
        }))
    benchmarks.append(BenchmarkInfo(
        name: "Prims.NonStrongRef.UnownedUnsafe.Closure",
        runFunction: run_PrimsUnownedUnsafeClosureAccess,
        tags: [.validation, .algorithm],
        setUpFunction: {
          touchGlobalInfo()
          blackHole(unownedUnsafePrimsState)
        }))
    benchmarks.append(BenchmarkInfo(
        name: "Prims.NonStrongRef.Unmanaged",
        runFunction: run_PrimsUnmanaged,
        tags: [.validation, .algorithm, .api],
        setUpFunction: {
          touchGlobalInfo()
          blackHole(unmanagedPrimsState)
        }))
    benchmarks.append(BenchmarkInfo(
        name: "Prims.NonStrongRef.Unmanaged.Closure",
        runFunction: run_PrimsUnmanagedClosureAccess,
        tags: [.validation, .algorithm, .api],
        setUpFunction: {
          touchGlobalInfo()
          blackHole(unmanagedPrimsState)
        }))
    benchmarks.append(BenchmarkInfo(
        name: "Prims.NonStrongRef.UnmanagedUGR",
        runFunction: run_PrimsUnmanagedUGR,
        tags: [.validation, .algorithm, .api],
        setUpFunction: {
          touchGlobalInfo()
          blackHole(unmanagedUGRPrimsState)
        }))
    benchmarks.append(BenchmarkInfo(
        name: "Prims.NonStrongRef.UnmanagedUGR.Closure",
        runFunction: run_PrimsUnmanagedUGRClosureAccess,
        tags: [.validation, .algorithm, .api],
        setUpFunction: {
          touchGlobalInfo()
          blackHole(unmanagedUGRPrimsState)
        }))
{'fraction_non_alphanumeric': 0.13847502191060473, 'fraction_numerical': 0.0026292725679228747, 'mean_word_length': 2.3160188884852886, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6194269', 'n_tokens_mistral': 2629, 'n_tokens_neox': 2497, 'n_words': 626}