mirror of
				https://github.com/Zygo/bees.git
				synced 2025-11-04 12:10:34 +01:00 
			
		
		
		
	After some benchmarking, it turns out that std::vector<uint8_t> is about 160 times slower than malloc(). malloc() is faster than "new uint8_t[]" too. Get rid of std:;vector<uint8_t> and replace it with a lightweight wrapper around malloc(), free(), and memcpy(). ByteVector has helpful methods for the common case of moving data to and from ioctl calls that use a fixed-length header placed contiguously with a variable-length input/output buffer. Data bytes are shared between copied ByteVector objects, allowing a large single buffer to be cheaply chopped up into smaller objects without memory copies. ByteVector implements the more useful parts of the std::vector API, so it can replace std::vector objects without needing an awkward adaptor class like Spanner. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
		
			
				
	
	
		
			53 lines
		
	
	
		
			1014 B
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			1014 B
		
	
	
	
		
			Makefile
		
	
	
	
	
	
TAG ?= $(shell git describe --always --dirty || echo UNKNOWN)
 | 
						|
 | 
						|
default: libcrucible.a
 | 
						|
%.a: Makefile
 | 
						|
 | 
						|
CRUCIBLE_OBJS = \
 | 
						|
	bytevector.o \
 | 
						|
	chatter.o \
 | 
						|
	city.o \
 | 
						|
	cleanup.o \
 | 
						|
	crc64.o \
 | 
						|
	error.o \
 | 
						|
	extentwalker.o \
 | 
						|
	fd.o \
 | 
						|
	fs.o \
 | 
						|
	ntoa.o \
 | 
						|
	path.o \
 | 
						|
	process.o \
 | 
						|
	string.o \
 | 
						|
	task.o \
 | 
						|
	time.o \
 | 
						|
 | 
						|
include ../makeflags
 | 
						|
-include ../localconf
 | 
						|
include ../Defines.mk
 | 
						|
 | 
						|
BEES_LDFLAGS = $(LDFLAGS)
 | 
						|
 | 
						|
configure.h: configure.h.in
 | 
						|
	$(TEMPLATE_COMPILER)
 | 
						|
 | 
						|
.depends:
 | 
						|
	mkdir -p $@
 | 
						|
 | 
						|
.depends/%.dep: %.cc configure.h Makefile | .depends
 | 
						|
	$(CXX) $(BEES_CXXFLAGS) -M -MF $@ -MT $(<:.cc=.o) $<
 | 
						|
 | 
						|
depends.mk: $(CRUCIBLE_OBJS:%.o=.depends/%.dep)
 | 
						|
	cat $^ > $@.new
 | 
						|
	mv -f $@.new $@
 | 
						|
 | 
						|
.version.cc: configure.h Makefile ../makeflags $(CRUCIBLE_OBJS:.o=.cc) ../include/crucible/*.h
 | 
						|
	echo "namespace crucible { const char *VERSION = \"$(TAG)\"; }" > $@.new
 | 
						|
	if ! cmp "$@.new" "$@"; then mv -fv $@.new $@; fi
 | 
						|
 | 
						|
include depends.mk
 | 
						|
 | 
						|
%.o: %.cc ../makeflags
 | 
						|
	$(CXX) $(BEES_CXXFLAGS) -o $@ -c $<
 | 
						|
 | 
						|
libcrucible.a: $(CRUCIBLE_OBJS) .version.o
 | 
						|
	$(AR) rcs $@ $^
 |