summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/methodpool.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-20 13:22:19 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-22 00:02:05 +0000
commit0381b78aa4dfc0d338fba69502e8f03a0c0f21e7 (patch)
tree6d9a33949354cb9824c1a8fcabea1422ac692bb9 /bitbake/lib/bb/methodpool.py
parentc61c1eb26a082c81473a45977cad5f811d2cf598 (diff)
downloadpoky-0381b78aa4dfc0d338fba69502e8f03a0c0f21e7.tar.gz
bitbake: event/utils/methodpool: Add a cache of compiled code objects
With the addition of function line number handling, the overhead of the compile functions is no longer negligible. We tend to compile the same pieces of code over and over again so wrapping a cache around this is beneficial and removes the overhead of line numbered functions. Life cycle of a cache using a global like this is in theory problematic although in reality unlikely to be an issue. It can be dealt with if/as/when we deal with the other global caches. (Bitbake rev: 98d7002d1dca4b62042e1589fd5b9b3805d57f7a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/methodpool.py')
-rw-r--r--bitbake/lib/bb/methodpool.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/bitbake/lib/bb/methodpool.py b/bitbake/lib/bb/methodpool.py
index b2ea1a1887..49aed3338b 100644
--- a/bitbake/lib/bb/methodpool.py
+++ b/bitbake/lib/bb/methodpool.py
@@ -27,3 +27,14 @@ def insert_method(modulename, code, fn, lineno):
27 comp = better_compile(code, modulename, fn, lineno=lineno) 27 comp = better_compile(code, modulename, fn, lineno=lineno)
28 better_exec(comp, None, code, fn) 28 better_exec(comp, None, code, fn)
29 29
30compilecache = {}
31
32def compile_cache(code):
33 h = hash(code)
34 if h in compilecache:
35 return compilecache[h]
36 return None
37
38def compile_cache_add(code, compileobj):
39 h = hash(code)
40 compilecache[h] = compileobj