Commit 28df5108 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Move the static computation out of the hot areas; thought this would help more

parent 4bde2afd
...@@ -31,6 +31,10 @@ ...@@ -31,6 +31,10 @@
namespace pyston { namespace pyston {
namespace gc { namespace gc {
#if STAT_TIMERS
int gc_alloc_stattimer_id = Stats::getStatId("us_timer_gc_alloc");
#endif
extern "C" void* gc_compat_malloc(size_t sz) noexcept { extern "C" void* gc_compat_malloc(size_t sz) noexcept {
return gc_alloc(sz, GCKind::CONSERVATIVE); return gc_alloc(sz, GCKind::CONSERVATIVE);
} }
......
...@@ -40,8 +40,13 @@ static StatCounter gc_alloc_bytes_typed[] = { ...@@ -40,8 +40,13 @@ static StatCounter gc_alloc_bytes_typed[] = {
}; };
#endif #endif
#if STAT_TIMERS
extern int gc_alloc_stattimer_id;
#endif
extern "C" inline void* gc_alloc(size_t bytes, GCKind kind_id) { extern "C" inline void* gc_alloc(size_t bytes, GCKind kind_id) {
STAT_TIMER(t0, "us_timer_gc_alloc"); #if STAT_TIMERS
StatTimer gc_alloc_stattimer(gc_alloc_stattimer_id);
#endif
size_t alloc_bytes = bytes + sizeof(GCAllocation); size_t alloc_bytes = bytes + sizeof(GCAllocation);
#ifndef NVALGRIND #ifndef NVALGRIND
......
...@@ -123,8 +123,15 @@ static Box* (*callattrInternal2)(Box*, llvm::StringRef, LookupScope, CallRewrite ...@@ -123,8 +123,15 @@ static Box* (*callattrInternal2)(Box*, llvm::StringRef, LookupScope, CallRewrite
static Box* (*callattrInternal3)(Box*, llvm::StringRef, LookupScope, CallRewriteArgs*, ArgPassSpec, Box*, Box*, Box*) static Box* (*callattrInternal3)(Box*, llvm::StringRef, LookupScope, CallRewriteArgs*, ArgPassSpec, Box*, Box*, Box*)
= (Box * (*)(Box*, llvm::StringRef, LookupScope, CallRewriteArgs*, ArgPassSpec, Box*, Box*, Box*))callattrInternal; = (Box * (*)(Box*, llvm::StringRef, LookupScope, CallRewriteArgs*, ArgPassSpec, Box*, Box*, Box*))callattrInternal;
#if STAT_TIMERS
static int pyhasher_timer_id = Stats::getStatId("us_timer_PyHasher");
static int pyeq_timer_id = Stats::getStatId("us_timer_PyEq");
static int pylt_timer_id = Stats::getStatId("us_timer_PyLt");
#endif
size_t PyHasher::operator()(Box* b) const { size_t PyHasher::operator()(Box* b) const {
STAT_TIMER(t0, "us_timer_PyHasher"); #if STAT_TIMERS
StatTimer _st(pyhasher_timer_id);
#endif
if (b->cls == str_cls) { if (b->cls == str_cls) {
StringHash<char> H; StringHash<char> H;
auto s = static_cast<BoxedString*>(b); auto s = static_cast<BoxedString*>(b);
...@@ -135,7 +142,9 @@ size_t PyHasher::operator()(Box* b) const { ...@@ -135,7 +142,9 @@ size_t PyHasher::operator()(Box* b) const {
} }
bool PyEq::operator()(Box* lhs, Box* rhs) const { bool PyEq::operator()(Box* lhs, Box* rhs) const {
STAT_TIMER(t0, "us_timer_PyEq"); #if STAT_TIMERS
StatTimer _st(pyeq_timer_id);
#endif
int r = PyObject_RichCompareBool(lhs, rhs, Py_EQ); int r = PyObject_RichCompareBool(lhs, rhs, Py_EQ);
if (r == -1) if (r == -1)
...@@ -144,7 +153,9 @@ bool PyEq::operator()(Box* lhs, Box* rhs) const { ...@@ -144,7 +153,9 @@ bool PyEq::operator()(Box* lhs, Box* rhs) const {
} }
bool PyLt::operator()(Box* lhs, Box* rhs) const { bool PyLt::operator()(Box* lhs, Box* rhs) const {
STAT_TIMER(t0, "us_timer_PyLt"); #if STAT_TIMERS
StatTimer _st(pylt_timer_id);
#endif
int r = PyObject_RichCompareBool(lhs, rhs, Py_LT); int r = PyObject_RichCompareBool(lhs, rhs, Py_LT);
if (r == -1) if (r == -1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment