Commit beba0d13 authored by John Zhang's avatar John Zhang

modified alloc benchmark

Preallocate 2D lists of pointers, purely index and assign within loop.
This should remove the list append overhead.

Also turn off GC on PyPy C backend, increase scale factor to have longer
running time and more reliable measurements.
parent 7eda707e
......@@ -12,60 +12,60 @@
# See the License for the specific language governing permissions and
# limitations under the License.
fib:
iterations: 20
benchmark:
name: micro/fib
args:
- 10 # scale factor
- 35
callback:
name: clock
param: "6"
tasks:
rpyc_O3:
language:
name: rpython
backend: c
source: targetfib.py
compiler:
flags:
- --gc=none
environ:
PYPY_C_CLANG_OPT_FLAG: -O3
PYPY_USESSION_BASENAME: fib_rpyc_O3
rpyzebu:
language:
name: rpython
backend: mu
impl: zebu
source: targetfib.py
compiler:
pypydir: $PYPY_MU
environ:
ZEBU_BUILD: release
PYPY_USESSION_DIR: example
PYPY_USESSION_BASENAME: fib_rpyzebu
c_O3:
language: c
source: fib.c
compiler:
flags:
- -O3
mu_fast:
language:
name: mu
impl: zebu
source: build_fib.c
compiler:
flags:
- -DBUILD_FIB_FAST
# fib:
# iterations: 20
# benchmark:
# name: micro/fib
# args:
# - 10 # scale factor
# - 35
# callback:
# name: clock
# param: "6"
# tasks:
# rpyc_O3:
# language:
# name: rpython
# backend: c
# source: targetfib.py
# compiler:
# flags:
# - --gc=none
# environ:
# PYPY_C_CLANG_OPT_FLAG: -O3
# PYPY_USESSION_BASENAME: fib_rpyc_O3
# rpyzebu:
# language:
# name: rpython
# backend: mu
# impl: zebu
# source: targetfib.py
# compiler:
# pypydir: $PYPY_MU
# environ:
# ZEBU_BUILD: release
# PYPY_USESSION_DIR: example
# PYPY_USESSION_BASENAME: fib_rpyzebu
# c_O3:
# language: c
# source: fib.c
# compiler:
# flags:
# - -O3
# mu_fast:
# language:
# name: mu
# impl: zebu
# source: build_fib.c
# compiler:
# flags:
# - -DBUILD_FIB_FAST
alloc:
iterations: 20
benchmark:
name: micro/alloc
args:
- 10 # scale factor
- 2000 # scale factor
- 10000
callback:
name: clock
......@@ -76,118 +76,125 @@ alloc:
name: rpython
backend: c
source: targetalloc.py
rpyzebu:
language:
name: rpython
backend: mu
impl: zebu
source: targetalloc.py
except:
benchmark:
name: micro/except
args:
- 2000
- 1
- 10
iterations: 20
callback:
name: clock
param: "6"
environ:
PYPY_USESSION_DIR: example
tasks:
rpyc_O3:
language:
name: rpython
backend: c
source: targetexcept.py
environ:
PYPY_C_CLANG_OPT_FLAG: -O3
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
rpyzebu:
language:
name: rpython
backend: mu
impl: zebu
source: targetexcept.py
environ:
PYPY_USESSION_BASENAME: except_rpyzebu
som:
iterations: 20
benchmark:
name: SOM
args:
- -cp
- $RPYSOM/Smalltalk
- $RPYSOM/TestSuite/TestHarness.som
callback:
name: clock
param: "6"
environ:
PYPY_USESSION_DIR: example # controls where PyPy puts usession directory
PYTHONPATH: $RPYSOM/src
tasks:
rpyc_O3:
language:
name: rpython
backend: c
source: targetrpysom.py
environ:
PYPY_C_CLANG_OPT_FLAG: -O3
PYPY_USESSION_BASENAME: som_rpyc_O3
rpyzebu:
language:
name: rpython
backend: mu
impl: zebu
source: targetrpysom.py
environ:
ZEBU_BUILD: "release"
PYPY_USESSION_BASENAME: som_rpyzebu
quicksort:
benchmark:
name: micro/quicksort
iterations: 20
callback:
name: clock
param: "6"
environ:
PYPY_USESSION_DIR: example
tasks:
rpyc_O0:
language:
name: rpython
backend: c
source: targetquicksort.py
environ:
PYPY_C_CLANG_OPT_FLAG: -O0
PYPY_USESSION_BASENAME: &basename "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
flags:
- --gc=none
compiler:
args:
- &scale_factor 1000
rpyc_O3:
language:
name: rpython
backend: c
source: targetquicksort.py
environ:
PYPY_C_CLANG_OPT_FLAG: -O3
PYPY_USESSION_BASENAME: *basename
flags:
- --gc=none
compiler:
args:
- *scale_factor
flags:
- --gc=none # disable GC on PyPy
rpyzebu:
language:
name: rpython
backend: mu
impl: zebu
source: targetquicksort.py
environ:
PYPY_USESSION_BASENAME: *basename
source: targetalloc.py
compiler:
args:
- *scale_factor
vmargs:
- --gc-immixspace-size=524288000 # 500M
- --gc-lospace-size=104587600 # 100M
# except:
# benchmark:
# name: micro/except
# args:
# - 2000
# - 1
# - 10
# iterations: 20
# callback:
# name: clock
# param: "6"
# environ:
# PYPY_USESSION_DIR: example
# tasks:
# rpyc_O3:
# language:
# name: rpython
# backend: c
# source: targetexcept.py
# environ:
# PYPY_C_CLANG_OPT_FLAG: -O3
# PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
# rpyzebu:
# language:
# name: rpython
# backend: mu
# impl: zebu
# source: targetexcept.py
# environ:
# PYPY_USESSION_BASENAME: except_rpyzebu
# som:
# iterations: 20
# benchmark:
# name: SOM
# args:
# - -cp
# - $RPYSOM/Smalltalk
# - $RPYSOM/TestSuite/TestHarness.som
# callback:
# name: clock
# param: "6"
# environ:
# PYPY_USESSION_DIR: example # controls where PyPy puts usession directory
# PYTHONPATH: $RPYSOM/src
# tasks:
# rpyc_O3:
# language:
# name: rpython
# backend: c
# source: targetrpysom.py
# environ:
# PYPY_C_CLANG_OPT_FLAG: -O3
# PYPY_USESSION_BASENAME: som_rpyc_O3
# rpyzebu:
# language:
# name: rpython
# backend: mu
# impl: zebu
# source: targetrpysom.py
# environ:
# ZEBU_BUILD: "release"
# PYPY_USESSION_BASENAME: som_rpyzebu
# quicksort:
# benchmark:
# name: micro/quicksort
# iterations: 20
# callback:
# name: clock
# param: "6"
# environ:
# PYPY_USESSION_DIR: example
# tasks:
# rpyc_O0:
# language:
# name: rpython
# backend: c
# source: targetquicksort.py
# environ:
# PYPY_C_CLANG_OPT_FLAG: -O0
# PYPY_USESSION_BASENAME: &basename "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
# flags:
# - --gc=none
# compiler:
# args:
# - &scale_factor 1000
# rpyc_O3:
# language:
# name: rpython
# backend: c
# source: targetquicksort.py
# environ:
# PYPY_C_CLANG_OPT_FLAG: -O3
# PYPY_USESSION_BASENAME: *basename
# flags:
# - --gc=none
# compiler:
# args:
# - *scale_factor
# rpyzebu:
# language:
# name: rpython
# backend: mu
# impl: zebu
# source: targetquicksort.py
# environ:
# PYPY_USESSION_BASENAME: *basename
# compiler:
# args:
# - *scale_factor
......@@ -30,14 +30,16 @@ def target(driver, args):
scale_factor = int(argv[2])
n = int(argv[3])
lst = []
lst = [[None] * n] * scale_factor
cb.begin()
for j in range(scale_factor):
l = lst[j]
for k in range(n):
lst.append(A())
l[k] = A()
cb.end()
cb.report()
return int(not (len(lst) == n * scale_factor))
# return int(not (len(lst) == n * scale_factor))
return 0
return main, None
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