forked from shirok/Gauche
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add benchmark script to integerate map/for-each generics
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
;; | ||
;; How slow if we make default 'map' and 'for-each' generic functions? | ||
;; | ||
|
||
(use gauche.time) | ||
(use gauche.sequence :rename ((map generic-map) (for-each generic-for-each))) | ||
|
||
((with-module gauche.object generic-build-dispatcher!) | ||
generic-for-each 1) | ||
|
||
(define (repeat f) | ||
(dotimes [1000] | ||
(f identity '(a a a a a a a a a a)))) | ||
|
||
(define (bench) | ||
(time-these/report '(cpu 10) | ||
`((specific . ,(cut repeat for-each)) | ||
(generic . ,(cut repeat generic-for-each))))) | ||
|
||
(define (main args) | ||
(bench) | ||
0) |