/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <folly/compression/CompressionContextPool.h> #include <folly/concurrency/CacheLocality.h> namespace folly { namespace compression { /** * This class is intended to reduce contention on reserving a compression * context and improve cache locality (but maybe not hotness) of the contexts * it manages. * * This class uses folly::AccessSpreader to spread the managed object across * NumStripes domains (which should correspond to a topologically close set of * hardware threads). This cache is still backed by the basic locked stack in * the folly::compression::CompressionContextPool. * * Note that there is a tradeoff in choosing the number of stripes. More stripes * make for less contention, but mean that a context is less likely to be hot * in cache. */ template < typename T, typename Creator, typename Deleter, typename Resetter, size_t NumStripes = 8> class CompressionCoreLocalContextPool { … }; } // namespace compression } // namespace folly