[cfe-dev] some notes about templates

Larry Evans cppljevans at suddenlink.net
Tue Jul 2 10:02:50 PDT 2013


On 07/02/13 11:52, Larry Evans wrote:
[snip]
> clang3.3 does much better than gcc4.8, at least according to the
> attached timings.
> 
> The test driver is also attached.
> 
[snip]
OOPS.  The make file might also help a bit in clarifying the
timings.  It's attached.  It was invoked with:

make -f tuple.benchmark.simple.mk timings

-Larry


-------------- next part --------------
MAIN=tuple.benchmark.simple
HOW=gcc4_8_rel
#HOW=clangxx_rel
TUPLE_SIZE=4
INCLUDED=$(MAIN).hpp # file #included in $(MAIN).cpp
COMPILE.cmd=$(COMPILE.$(HOW)) $(INCS) $(MAIN).cpp
LINK.cmd=$(LINK.$(HOW)) $(MAIN).o -o $(MAIN).exe
TIME.cmd=time --format '%Uuser %Iinputs+%Ooutputs (%Xtext+%Ddata %Mmax)k (%Fmajor+%Rminor)pagefaults %Wswaps'

DIR.root := $(shell dirup_dir_file.pl $(PWD) root.imk)
include $(DIR.root)/root.imk
INCS:= -I/home/evansl/prog_dev/boost-svn/ro/boost_1_53_0/sandbox/rw/variadic_templates/sandbox/slim/slim/include $(INCS)

.PHONY: all
all: $(MAIN).cpp
	python $(MAIN).py $(TUPLE_SIZE) > $(INCLUDED)
	$(TIME.cmd) $(COMPILE.cmd) -DTUPLE_SIZE=$(TUPLE_SIZE)
	$(TIME.cmd) $(LINK.cmd)
	$(TIME.cmd) ./$(MAIN).exe

.PHONY: timings
timings:
	-rm $(MAIN).$(HOW).txt
	touch $(MAIN).$(HOW).txt
	for TSIZE in 10 50 100 200 300 400 500 ; do \
	  echo -n $$TSIZE "">> $(MAIN).$(HOW).txt ; \
	  python $(MAIN).py $$TSIZE > $(INCLUDED) ; \
	  $(TIME.cmd) $(COMPILE.cmd) 2>> $(MAIN).$(HOW).txt ; \
	  $(LINK.cmd) ; \
	  ./$(MAIN).exe ; \
	done \
	#

.PHONY: echo
echo:
	ls -ld $(PATH.llvm.top)	
	ls -ld $(COMPILER.clangxx_rel)

.PHONY: test
test:
	$(COMPILER.clangxx_rel) -c test.cpp -o test.exe



More information about the cfe-dev mailing list