Commit 889a2fdd authored by Kevin Modzelewski's avatar Kevin Modzelewski

Add simple itertools.chain benchmark

something like 40x slower.  also, has some sort of super-linear overhead:
10xing the size of the benchmark takes 33x longer for us, but 10x longer
for cpython.  (Looks like it's coming from the GC)
parent 02514fd3
# simple benchmark to test iteration over extension objects
import itertools
def f(c):
for i in c:
pass
l = []
for i in xrange(100):
l.append(itertools.chain(*[range(500) for j in xrange(500)]))
c = itertools.chain(*l)
f(c)
def f(n):
for i in xrange(n):
pass
f(100000000)
......@@ -2723,11 +2723,22 @@ extern "C" Box* callattrInternal(Box* obj, BoxedString* attr, LookupScope scope,
extern "C" Box* callattr(Box* obj, BoxedString* attr, CallattrFlags flags, ArgPassSpec argspec, Box* arg1, Box* arg2,
Box* arg3, Box** args, const std::vector<BoxedString*>* keyword_names) {
STAT_TIMER(t0, "us_timer_slowpath_callattr", 10);
#if 0
#if 0 && STAT_TIMERS
static uint64_t* st_id = Stats::getStatCounter("us_timer_slowpath_callattr_patchable");
static uint64_t* st_id_nopatch = Stats::getStatCounter("us_timer_slowpath_callattr_nopatch");
bool havepatch = (bool)getICInfo(__builtin_extract_return_addr(__builtin_return_address(0)));
ScopedStatTimer st(havepatch ? st_id : st_id_nopatch, 10);
static uint64_t* st_id_megamorphic = Stats::getStatCounter("us_timer_slowpath_callattr_megamorphic");
ICInfo* icinfo = getICInfo(__builtin_extract_return_addr(__builtin_return_address(0)));
uint64_t* counter;
if (!icinfo)
counter = st_id_nopatch;
else if (icinfo->isMegamorphic())
counter = st_id_megamorphic;
else {
//counter = Stats::getStatCounter("us_timer_slowpath_callattr_patchable_" + std::string(obj->cls->tp_name));
counter = Stats::getStatCounter("us_timer_slowpath_callattr_patchable_" + std::string(attr->s()));
}
ScopedStatTimer st(counter, 10);
#endif
ASSERT(gc::isValidGCObject(obj), "%p", obj);
......
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