vectors.bm 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. ;;; -*- mode: scheme; coding: iso-8859-1; -*-
  2. ;;; Vectors.
  3. ;;;
  4. ;;; Copyright 2009 Free Software Foundation, Inc.
  5. ;;;
  6. ;;; This program is free software; you can redistribute it and/or
  7. ;;; modify it under the terms of the GNU Lesser General Public License
  8. ;;; as published by the Free Software Foundation; either version 3, or
  9. ;;; (at your option) any later version.
  10. ;;;
  11. ;;; This program is distributed in the hope that it will be useful,
  12. ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;;; GNU Lesser General Public License for more details.
  15. ;;;
  16. ;;; You should have received a copy of the GNU Lesser General Public
  17. ;;; License along with this software; see the file COPYING.LESSER. If
  18. ;;; not, write to the Free Software Foundation, Inc., 51 Franklin
  19. ;;; Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. (define-module (benchmarks vectors)
  21. :use-module (benchmark-suite lib))
  22. ;; Note: Use `--iteration-factor' to change this.
  23. (define iterations 1000000)
  24. (with-benchmark-prefix "constructors"
  25. (benchmark "vector (opcode)" iterations
  26. (vector 1 2 3 4 5 6 7))
  27. (benchmark "vector (procedure)" iterations
  28. (let ((v vector))
  29. (v 1 2 3 4 5 6 7)))
  30. (benchmark "make-vector" iterations
  31. (make-vector 7)))
  32. (with-benchmark-prefix "pairs" ;; for comparison
  33. (benchmark "list (opcode)" iterations
  34. (list 1 2 3 4 5 6 7))
  35. (benchmark "list (procedure)" iterations
  36. (let ((l list))
  37. (l 1 2 3 4 5 6 7)))
  38. (benchmark "make-list" iterations
  39. (make-list 7)))