]> git.kaiwu.me - quickjs.git/commitdiff
Add benchmarks target
authorCharlie Gordon <github@chqrlie.org>
Sun, 18 Feb 2024 16:52:35 +0000 (17:52 +0100)
committerCharlie Gordon <github@chqrlie.org>
Mon, 19 Feb 2024 00:13:07 +0000 (01:13 +0100)
- assuming quickjs-benchmarks is cloned in the parent directory,
- compile quickjs-benchmarks targets and run the benchmarks

.gitignore
Makefile

index 2e924309832ff1d5c456aa49f4e536eb1a41e98c..5988f927ab2f2335c48c65a5faf4a4d27c65a008 100644 (file)
@@ -20,3 +20,5 @@ test262o
 test262o_*.txt
 unicode
 unicode_gen
+run_octane
+run_sunspider_like
index 44aaa0c935dc51ed96c129c08e0cb8d4347e1450..f16a69a067a49af88d8942cd2bf40093559df1f1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -351,6 +351,7 @@ clean:
        rm -f examples/*.so tests/*.so
        rm -rf $(OBJDIR)/ *.dSYM/ qjs-debug
        rm -rf run-test262-debug run-test262-32
+       rm -f run_octane run_sunspider_like
 
 install: all
        mkdir -p "$(DESTDIR)$(PREFIX)/bin"
@@ -531,4 +532,18 @@ bench-v8: qjs
 tests/bjson.so: $(OBJDIR)/tests/bjson.pic.o
        $(CC) $(LDFLAGS) -shared -o $@ $^ $(LIBS)
 
+BENCHMARKDIR=../quickjs-benchmarks
+
+run_sunspider_like: $(BENCHMARKDIR)/run_sunspider_like.c
+       $(CC) $(CFLAGS) $(LDFLAGS) -DNO_INCLUDE_DIR -I. -o $@ $< libquickjs$(LTOEXT).a $(LIBS)
+
+run_octane: $(BENCHMARKDIR)/run_octane.c
+       $(CC) $(CFLAGS) $(LDFLAGS) -DNO_INCLUDE_DIR -I. -o $@ $< libquickjs$(LTOEXT).a $(LIBS)
+
+benchmarks: run_sunspider_like run_octane
+       ./run_sunspider_like $(BENCHMARKDIR)/kraken-1.0/
+       ./run_sunspider_like $(BENCHMARKDIR)/kraken-1.1/
+       ./run_sunspider_like $(BENCHMARKDIR)/sunspider-1.0/
+       ./run_octane $(BENCHMARKDIR)/
+
 -include $(wildcard $(OBJDIR)/*.d)