mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
Import R6RS bytevectors and I/O ports from Guile-R6RS-Libs 0.2.
* README: Document dependency on GNU libunistring. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add `benchmark/bytevectors.bm'. * configure.in: Make sure we have libunistring; update $LIBS. * libguile.h: Include "bytevectors.h" and "r6rs-ports.h". * libguile/Makefile.am (libguile_la_SOURCES): Add `bytevectors.c' and `r6rs-ports.c' (DOT_X_FILES): Add `bytevectors.x' and `r6rs-ports.x'. (DOT_DOC_FILES): Add `bytevectors.doc' and `r6rs-ports.doc'. (noinst_HEADERS): Add `ieee-754.h'. (modinclude_HEADERS): Add `bytevectors.h' and `r6rs-ports.h' * libguile/validate.h (SCM_VALIDATE_BYTEVECTOR): New macro. * module/Makefile.am (SOURCES): Add $(RNRS_SOURCES). (RNRS_SOURCES): New variable. * test-suite/Makefile.am (SCM_TESTS): Add `bytevectors.test' and `r6rs-ports.test'.
This commit is contained in:
parent
24d56127bb
commit
1ee2c72eaf
18 changed files with 4688 additions and 12 deletions
|
@ -1,4 +1,5 @@
|
|||
SCM_BENCHMARKS = benchmarks/0-reference.bm \
|
||||
benchmarks/bytevectors.bm \
|
||||
benchmarks/continuations.bm \
|
||||
benchmarks/if.bm \
|
||||
benchmarks/logand.bm \
|
||||
|
|
99
benchmark-suite/benchmarks/bytevectors.bm
Normal file
99
benchmark-suite/benchmarks/bytevectors.bm
Normal file
|
@ -0,0 +1,99 @@
|
|||
;;; -*- mode: scheme; coding: latin-1; -*-
|
||||
;;; R6RS Byte Vectors.
|
||||
;;;
|
||||
;;; Copyright 2009 Ludovic Courtès <ludo@gnu.org>
|
||||
;;;
|
||||
;;;
|
||||
;;; This program is free software; you can redistribute it and/or modify
|
||||
;;; it under the terms of the GNU General Public License as published by
|
||||
;;; the Free Software Foundation; either version 2 of the License, or
|
||||
;;; (at your option) any later version.
|
||||
;;;
|
||||
;;; This program is distributed in the hope that it will be useful,
|
||||
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;;; GNU General Public License for more details.
|
||||
;;;
|
||||
;;; You should have received a copy of the GNU General Public License
|
||||
;;; along with this program; if not, write to the Free Software
|
||||
;;; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
(define-module (benchmarks bytevector)
|
||||
:use-module (rnrs bytevector)
|
||||
:use-module (srfi srfi-4)
|
||||
:use-module (benchmark-suite lib))
|
||||
|
||||
(define bv (make-bytevector 16384))
|
||||
|
||||
(define %native-endianness
|
||||
(native-endianness))
|
||||
|
||||
(define %foreign-endianness
|
||||
(if (eq? (native-endianness) (endianness little))
|
||||
(endianness big)
|
||||
(endianness little)))
|
||||
|
||||
(define u8v (make-u8vector 16384))
|
||||
(define u16v (make-u16vector 8192))
|
||||
(define u32v (make-u32vector 4196))
|
||||
(define u64v (make-u64vector 2048))
|
||||
|
||||
|
||||
(with-benchmark-prefix "ref/set!"
|
||||
|
||||
(benchmark "bytevector-u8-ref" 1000000
|
||||
(bytevector-u8-ref bv 0))
|
||||
|
||||
(benchmark "bytevector-u16-ref (foreign)" 1000000
|
||||
(bytevector-u16-ref bv 0 %foreign-endianness))
|
||||
|
||||
(benchmark "bytevector-u16-ref (native)" 1000000
|
||||
(bytevector-u16-ref bv 0 %native-endianness))
|
||||
|
||||
(benchmark "bytevector-u16-native-ref" 1000000
|
||||
(bytevector-u16-native-ref bv 0))
|
||||
|
||||
(benchmark "bytevector-u32-ref (foreign)" 1000000
|
||||
(bytevector-u32-ref bv 0 %foreign-endianness))
|
||||
|
||||
(benchmark "bytevector-u32-ref (native)" 1000000
|
||||
(bytevector-u32-ref bv 0 %native-endianness))
|
||||
|
||||
(benchmark "bytevector-u32-native-ref" 1000000
|
||||
(bytevector-u32-native-ref bv 0))
|
||||
|
||||
(benchmark "bytevector-u64-ref (foreign)" 1000000
|
||||
(bytevector-u64-ref bv 0 %foreign-endianness))
|
||||
|
||||
(benchmark "bytevector-u64-ref (native)" 1000000
|
||||
(bytevector-u64-ref bv 0 %native-endianness))
|
||||
|
||||
(benchmark "bytevector-u64-native-ref" 1000000
|
||||
(bytevector-u16-native-ref bv 0)))
|
||||
|
||||
|
||||
(with-benchmark-prefix "lists"
|
||||
|
||||
(benchmark "bytevector->u8-list" 2000
|
||||
(bytevector->u8-list bv))
|
||||
|
||||
(benchmark "bytevector->uint-list 16-bit" 2000
|
||||
(bytevector->uint-list bv (native-endianness) 2))
|
||||
|
||||
(benchmark "bytevector->uint-list 64-bit" 2000
|
||||
(bytevector->uint-list bv (native-endianness) 8)))
|
||||
|
||||
|
||||
(with-benchmark-prefix "SRFI-4" ;; for comparison
|
||||
|
||||
(benchmark "u8vector-ref" 1000000
|
||||
(u8vector-ref u8v 0))
|
||||
|
||||
(benchmark "u16vector-ref" 1000000
|
||||
(u16vector-ref u16v 0))
|
||||
|
||||
(benchmark "u32vector-ref" 1000000
|
||||
(u32vector-ref u32v 0))
|
||||
|
||||
(benchmark "u64vector-ref" 1000000
|
||||
(u64vector-ref u64v 0)))
|
Loading…
Add table
Add a link
Reference in a new issue