You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2013/07/15 14:41:42 UTC
[lucy-commits] git commit: refs/heads/method-dispatch-benchmark - Benchmark without
symbol aliases on Linux
Updated Branches:
refs/heads/method-dispatch-benchmark 822028236 -> 1ee9b2d16
Benchmark without symbol aliases on Linux
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/1ee9b2d1
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/1ee9b2d1
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/1ee9b2d1
Branch: refs/heads/method-dispatch-benchmark
Commit: 1ee9b2d167f038b241b96927f8c2b5fe205b3b8c
Parents: 8220282
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon Jul 15 14:40:26 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon Jul 15 14:40:26 2013 +0200
----------------------------------------------------------------------
devel/benchmarks/method_dispatch/.gitignore | 3 +++
devel/benchmarks/method_dispatch/Makefile | 16 ----------------
devel/benchmarks/method_dispatch/Makefile.darwin | 16 ++++++++++++++++
devel/benchmarks/method_dispatch/Makefile.linux | 16 ++++++++++++++++
devel/benchmarks/method_dispatch/exe.c | 8 ++++++++
5 files changed, 43 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/1ee9b2d1/devel/benchmarks/method_dispatch/.gitignore
----------------------------------------------------------------------
diff --git a/devel/benchmarks/method_dispatch/.gitignore b/devel/benchmarks/method_dispatch/.gitignore
new file mode 100644
index 0000000..a82daf4
--- /dev/null
+++ b/devel/benchmarks/method_dispatch/.gitignore
@@ -0,0 +1,3 @@
+dso.dylib
+dso.so
+exe
http://git-wip-us.apache.org/repos/asf/lucy/blob/1ee9b2d1/devel/benchmarks/method_dispatch/Makefile
----------------------------------------------------------------------
diff --git a/devel/benchmarks/method_dispatch/Makefile b/devel/benchmarks/method_dispatch/Makefile
deleted file mode 100644
index 1975f65..0000000
--- a/devel/benchmarks/method_dispatch/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-CFLAGS = -std=gnu99 -Wextra -O2 -fomit-frame-pointer
-
-all : bench
-
-dso.dylib : dso.c dso.h oo.h
- gcc $(CFLAGS) -Wl,-alias,_thunk3,_Obj_Hello_THUNK -shared dso.c -o $@
-
-exe : exe.c dso.h oo.h dso.dylib
- gcc $(CFLAGS) exe.c dso.dylib -o $@
-
-bench : exe
- ./exe
-
-clean :
- rm -f dso.dylib exe
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1ee9b2d1/devel/benchmarks/method_dispatch/Makefile.darwin
----------------------------------------------------------------------
diff --git a/devel/benchmarks/method_dispatch/Makefile.darwin b/devel/benchmarks/method_dispatch/Makefile.darwin
new file mode 100644
index 0000000..6ee18c5
--- /dev/null
+++ b/devel/benchmarks/method_dispatch/Makefile.darwin
@@ -0,0 +1,16 @@
+CFLAGS = -std=gnu99 -Wextra -O2 -fomit-frame-pointer -DHAS_ALIAS
+
+all : bench
+
+dso.dylib : dso.c dso.h oo.h
+ gcc $(CFLAGS) -Wl,-alias,_thunk3,_Obj_Hello_THUNK -shared dso.c -o $@
+
+exe : exe.c dso.h oo.h dso.dylib
+ gcc $(CFLAGS) exe.c dso.dylib -o $@
+
+bench : exe
+ ./exe
+
+clean :
+ rm -f dso.dylib exe
+
http://git-wip-us.apache.org/repos/asf/lucy/blob/1ee9b2d1/devel/benchmarks/method_dispatch/Makefile.linux
----------------------------------------------------------------------
diff --git a/devel/benchmarks/method_dispatch/Makefile.linux b/devel/benchmarks/method_dispatch/Makefile.linux
new file mode 100644
index 0000000..8938e60
--- /dev/null
+++ b/devel/benchmarks/method_dispatch/Makefile.linux
@@ -0,0 +1,16 @@
+CFLAGS = -std=gnu99 -Wextra -O2 -fomit-frame-pointer
+
+all : bench
+
+dso.so : dso.c dso.h oo.h
+ gcc $(CFLAGS) -shared -fPIC dso.c -o $@
+
+exe : exe.c dso.h oo.h dso.so
+ gcc $(CFLAGS) -fPIE exe.c dso.so -o $@
+
+bench : exe
+ LD_LIBRARY_PATH=. ./exe
+
+clean :
+ rm -f dso.so exe
+
http://git-wip-us.apache.org/repos/asf/lucy/blob/1ee9b2d1/devel/benchmarks/method_dispatch/exe.c
----------------------------------------------------------------------
diff --git a/devel/benchmarks/method_dispatch/exe.c b/devel/benchmarks/method_dispatch/exe.c
index 8910c5f..4c9c622 100644
--- a/devel/benchmarks/method_dispatch/exe.c
+++ b/devel/benchmarks/method_dispatch/exe.c
@@ -38,6 +38,7 @@ loop_with_wrapper(obj_t *obj) {
}
}
+#ifdef HAS_ALIAS
void
loop_with_thunk(obj_t *obj) {
for (uint64_t i = 0; i < ITERATIONS; ++i) {
@@ -51,6 +52,7 @@ loop_with_thunk_ptr(obj_t *obj) {
Obj_Hello_THUNK_PTR(obj);
}
}
+#endif
NOINLINE void
single_call_with_wrapper(obj_t *obj) {
@@ -64,6 +66,7 @@ call_with_wrapper(obj_t *obj) {
}
}
+#ifdef HAS_ALIAS
NOINLINE void
single_call_with_thunk(obj_t *obj) {
Obj_Hello_THUNK(obj);
@@ -87,6 +90,7 @@ call_with_thunk(obj_t *obj) {
single_call_with_thunk(obj);
}
}
+#endif
static void
bench(method_t fn, const char *name) {
@@ -117,11 +121,15 @@ main() {
bench(loop_with_method_ptr, "method ptr loop");
bench(loop_with_wrapper, "wrapper loop");
+#ifdef HAS_ALIAS
bench(loop_with_thunk, "thunk loop");
bench(loop_with_thunk_ptr, "thunk ptr loop");
+#endif
bench(call_with_wrapper, "wrapper");
+#ifdef HAS_ALIAS
bench(call_with_thunk, "thunk");
bench(call_with_thunk_ptr, "thunk ptr");
+#endif
return 0;
}