up
@@ -0,0 +1,7 @@
+g++ -o pocketpy src/main.cpp --std=c++17 -pg -O1 -fno-rtti
+
+./pocketpy benchmarks/simple.py
+gprof pocketpy gmon.out > gprof.txt
+rm gmon.out
@@ -109,7 +109,7 @@ struct CodeObject {
/************************************************/
};
-static thread_local i64 kFrameGlobalId = 0;
+static THREAD_LOCAL i64 kFrameGlobalId = 0;
struct Frame {
std::vector<PyVar> _data;
@@ -56,4 +56,7 @@ template<typename T>
void* tid() {
static volatile int8_t _x;
return (void*)(&_x);
-}
+}
+//#define THREAD_LOCAL thread_local
+#define THREAD_LOCAL
@@ -149,7 +149,7 @@ namespace pkpy {
constexpr int kMemObjSize = sizeof(int) + sizeof(Py_<i64>);
- static thread_local MemBlock<kMemObjSize> _mem_pool(512);
+ static THREAD_LOCAL MemBlock<kMemObjSize> _mem_pool(512);
template<>
struct SpAllocator<PyObject> {
@@ -39,7 +39,7 @@ typedef emhash8::HashMap<Str, PyVar> NameDict;
namespace pkpy {
const int kMaxPoolSize = 10;
- static thread_local std::vector<PyVar*>* _args_pool = new std::vector<PyVar*>[kMaxPoolSize];
+ static THREAD_LOCAL std::vector<PyVar*>* _args_pool = new std::vector<PyVar*>[kMaxPoolSize];
class Args {
PyVar* _args;