This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,SIMD指令优化的是计算,对于内存复制之类的问题,限制在内存,使用SIMD指令优化很少; | |
2,SIMD指令也需要耗费时间,不要把若干移位和一两次乘法变成SIMD乘法,性能急剧下降; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace cxxdetail | |
{ | |
template <typename FuncType> | |
class InnerScopeExit | |
{ | |
public: | |
InnerScopeExit(const FuncType _func) :func(_func){} | |
~InnerScopeExit(){ if (!dismissed){ func(); } } | |
private: | |
FuncType func; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename CALLBACKTYPE,typename... ARGS> | |
class TimeoutHandler | |
{ | |
public: | |
TimeoutHandler(const int _timeout/*ms*/,CALLBACKTYPE _callback, ARGS... _args) | |
{ | |
std::thread([](TimeoutHandler* this_object,int _timeout, CALLBACKTYPE _callback, ARGS... _args) | |
{ | |
std::this_thread::sleep_for(std::chrono::milliseconds(_timeout)); | |
if (!this_object->exit_flag) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <functional> | |
class CScopedRelease | |
{ | |
public: | |
explicit CScopedRelease(std::function<void ()> pfnRelease) | |
: m_pfnRelease(pfnRelease) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstring> | |
#include <cassert> | |
#include <memory> | |
#include <ctime> | |
using namespace std; | |
bool g_bUseNormal = false; | |
int* next_array = nullptr; |
NewerOlder