1 ;;; hash.bm --- Hash functions. -*- Scheme -*-
3 ;;; Copyright (C) 2015 Free Software Foundation, Inc.
5 ;;; This program is free software; you can redistribute it and/or
6 ;;; modify it under the terms of the GNU Lesser General Public License
7 ;;; as published by the Free Software Foundation; either version 3, or
8 ;;; (at your option) any later version.
10 ;;; This program is distributed in the hope that it will be useful,
11 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ;;; GNU Lesser General Public License for more details.
15 ;;; You should have received a copy of the GNU Lesser General Public
16 ;;; License along with this software; see the file COPYING.LESSER. If
17 ;;; not, write to the Free Software Foundation, Inc., 51 Franklin
18 ;;; Street, Fifth Floor, Boston, MA 02110-1301 USA
20 (define-module (benchmarks write)
21 #:use-module (benchmark-suite lib))
23 (define %narrow-string
30 (make-string 300 #\x))
38 (with-syntax ((count (- (syntax->datum #'count) 1)))
41 (repeat count exp)))))))
44 (with-benchmark-prefix "string-hash"
46 (benchmark "narrow string" 100000
47 (repeat 100 (string-hash %narrow-string)))
49 (benchmark "wide string" 100000
50 (repeat 100 (string-hash %wide-string)))
52 (benchmark "long string" 100000
53 (repeat 100 (string-hash %long-string))))