Files
swift-mirror/stdlib/runtime/GlobalObjects.cpp
Dmitri Hrybenko 9177107940 stdlib/Hashing: move the hash seed variable to C++ code to avoid
dispatch_once calls on every load from it

Performance improvements, as reported by the perf testing buildbot:

Histogram       -18.81%
TwoSum          -17.42%
RGBHistogram    -9.65%

Regressions:

InsertionSort                5.59%
ArrayOfRef                   3.99%
SwiftStructuresInsertionSort 5.29%
PrimeNum                     6.09%

These regressions are bogus.  The tests that "regressed" don't do any
hashing at all.

Swift SVN r23995
2014-12-17 23:45:29 +00:00

43 lines
1.3 KiB
C++

//===--- GlobalObjects.cpp - Statically-initialized objects ---------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// Objects that are allocated at global scope instead of on the heap,
// and statically initialized to avoid synchronization costs, are
// defined here.
//
//===----------------------------------------------------------------------===//
#include "../shims/GlobalObjects.h"
#include "swift/Runtime/Metadata.h"
namespace swift {
// _direct type metadata for Swift._EmptyArrayStorage
extern "C" FullMetadata<ClassMetadata> _TMdCSs18_EmptyArrayStorage;
extern "C" _SwiftEmptyArrayStorage _swiftEmptyArrayStorage = {
// HeapObject header;
{
&_TMdCSs18_EmptyArrayStorage, // is-a pointer
},
// _SwiftArrayBodyStorage body;
{
0, // int count;
1 // unsigned int _capacityAndFlags; 1 means elementTypeIsBridgedVerbatim
}
};
extern "C"
uint64_t _swift_stdlib_HashingDetail_fixedSeedOverride = 0;
}