Mercurial > hg > cc > cirrus_work
changeset 277:018866252464 default tip
push value printing into C,
other tweaks to try to speed up, no joy
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Wed, 19 Feb 2025 17:49:31 +0000 |
parents | 76fb260e893b |
children | |
files | lib/python/cc/lmh/cdb.pxd lib/python/cc/lmh/db.pxd lib/python/cc/lmh/db.pyx lib/python/cc/lmh/get2.pyx |
diffstat | 4 files changed, 14 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/python/cc/lmh/cdb.pxd Wed Feb 19 17:48:11 2025 +0000 +++ b/lib/python/cc/lmh/cdb.pxd Wed Feb 19 17:49:31 2025 +0000 @@ -8,6 +8,7 @@ Cdb* cdb_new () void cdb_free(Cdb* cdb) void cdb_init(Cdb* cdb,int fd) + void cdb_init_nomap(Cdb* cdb,int fd) int cdb_read(Cdb* cdb,char *,unsigned int,uint32) @@ -15,6 +16,8 @@ int cdb_findnext(Cdb* cdb,char *,unsigned int) int cdb_find(Cdb* cdb,char *,unsigned int) + int cdb_write(Cdb *c,int fd) + unsigned int cdb_pos(Cdb* cdb); int cdb_len(Cdb* cdb);
--- a/lib/python/cc/lmh/db.pxd Wed Feb 19 17:48:11 2025 +0000 +++ b/lib/python/cc/lmh/db.pxd Wed Feb 19 17:49:31 2025 +0000 @@ -3,8 +3,10 @@ cdef cdb.Cdb* _c_cdb cdef char[::1] _c_mv cpdef char[::1] init(self, int fno) + cpdef void init_nomap(self, int fno) cpdef void findstart(self) cpdef int find(self, bytes p) + cpdef int write(self, int fd) cdef cdb.uint32 pos(self) cdef int len(self) cpdef long raw(self)
--- a/lib/python/cc/lmh/db.pyx Wed Feb 19 17:48:11 2025 +0000 +++ b/lib/python/cc/lmh/db.pyx Wed Feb 19 17:49:31 2025 +0000 @@ -13,11 +13,17 @@ cpdef int find(self, bytes p): return cdb.cdb_find(self._c_cdb, p, len(p)) + cpdef int write(self, int fd): + return cdb.cdb_write(self._c_cdb, fd) + cpdef char[::1] init(self, int fno): cdb.cdb_init(self._c_cdb,fno) self._c_mv = <char[:cdb.cdb_msize(self._c_cdb):1]>(cdb.cdb_mmap(self._c_cdb)) return self._c_mv + cpdef void init_nomap(self, int fno): + cdb.cdb_init_nomap(self._c_cdb, fno) + cdef cdb.uint32 pos(self): return cdb.cdb_pos(self._c_cdb) @@ -30,6 +36,3 @@ cpdef char[::1] value(self): o = cdb.cdb_pos(self._c_cdb) return self._c_mv[o: o+cdb.cdb_len(self._c_cdb)] - - -
--- a/lib/python/cc/lmh/get2.pyx Wed Feb 19 17:48:11 2025 +0000 +++ b/lib/python/cc/lmh/get2.pyx Wed Feb 19 17:49:31 2025 +0000 @@ -20,17 +20,16 @@ mvs = [0,1] for i in range(2): c = CCs[i] - mvs[i] = c.init(DBff[i].fileno()) + c.init(DBff[i].fileno()) c.findstart() for i in range(2): for probe in probes: c = CCs[i] res = c.find(probe) sys.stdout.buffer.write(b'%s %s '%(probe, sys.argv[i+1].encode('utf8'))) + sys.stdout.buffer.flush() if res == 1: - o=c.pos() - l=c.len() - sys.stdout.buffer.write(mvs[i][o:o+l]) + c.write(1) else: sys.stdout.buffer.write(b'missing') sys.stdout.buffer.write(b'\n')