[pypy-svn] pypy jit-lsprofile: promote those as well. What's really missing is a fast timer.
cfbolz
commits-noreply at bitbucket.org
Tue Jan 4 02:18:26 CET 2011
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: jit-lsprofile
Changeset: r40369:504fc1721f07
Date: 2011-01-04 01:49 +0100
http://bitbucket.org/pypy/pypy/changeset/504fc1721f07/
Log: promote those as well. What's really missing is a fast timer.
diff --git a/pypy/module/_lsprof/interp_lsprof.py b/pypy/module/_lsprof/interp_lsprof.py
--- a/pypy/module/_lsprof/interp_lsprof.py
+++ b/pypy/module/_lsprof/interp_lsprof.py
@@ -134,7 +134,7 @@
self.previous = profobj.current_context
entry.recursionLevel += 1
if profobj.subcalls and self.previous:
- caller = self.previous.entry
+ caller = jit.hint(self.previous.entry, promote=True)
subentry = caller._get_or_make_subentry(entry)
subentry.recursionLevel += 1
self.t0 = profobj.timer()
@@ -153,7 +153,7 @@
entry.it += it
entry.callcount += 1
if profobj.subcalls and self.previous:
- caller = self.previous.entry
+ caller = jit.hint(self.previous.entry, promote=True)
subentry = caller._get_or_make_subentry(entry, False)
if subentry is not None:
subentry.recursionLevel -= 1
diff --git a/pypy/jit/tl/pypyjit_demo.py b/pypy/jit/tl/pypyjit_demo.py
--- a/pypy/jit/tl/pypyjit_demo.py
+++ b/pypy/jit/tl/pypyjit_demo.py
@@ -1,17 +1,18 @@
try:
- import pypyjit
- pypyjit.set_param(threshold=3, inlining=True)
-
- def main():
- i=a=0
- while i<10:
- i+=1
- a+=1
- return a
-
- print main()
-
+ def g(x):
+ return x - 1
+ def f(x):
+ while x:
+ x = g(x)
+ import cProfile
+ import time
+ t1 = time.time()
+ cProfile.run("f(10000000)")
+ t2 = time.time()
+ f(10000000)
+ t3 = time.time()
+ print t2 - t1, t3 - t2, (t3 - t2) / (t2 - t1)
except Exception, e:
print "Exception: ", type(e)
print e
More information about the Pypy-commit
mailing list