10 Apr 20:48
c-wrapper: performance problem
From: Jens Thiele <karme <at> berlios.de>
Subject: c-wrapper: performance problem
Newsgroups: gmane.lisp.scheme.gauche
Date: 2008-04-10 18:52:36 GMT
Subject: c-wrapper: performance problem
Newsgroups: gmane.lisp.scheme.gauche
Date: 2008-04-10 18:52:36 GMT
Hi,
I am playing around with the really nice c-wrapper module. (thanks
alot!)
I stumbled across a performance problem:
Converting some c byte array (char*) to a u8vector is really slow. It
semms the bytes are copied byte for byte in scheme. But maybe my
approach is just plain wrong?
Attached a test script and some profile output (using -ptime).
Note: the profile output is for running the script with the line 24:
(time (c-byte-array-≥u8vector2 (cast (c-array <c-uchar> bytes) array)))
commented out and for 50000 and 100000 bytes.
#!/usr/bin/gosh
;; -*- coding: utf-8; mode: scheme -*-
;; test: performance problem with char/byte* -> u8vector
(use c-wrapper)
(use gauche.uvector)
(use gauche.sequence)
(c-load '("malloc.h"))
;; todo: really slow
(define (c-byte-array-≥u8vector1 array)
(cast <u8vector> array))
(Continue reading)
RSS Feed