Last active
December 22, 2019 13:08
-
-
Save Hamayama/79ad77ec66d99ab21389bf2f289b8ea1 to your computer and use it in GitHub Desktop.
Gauche プルリクエスト #558 測定結果
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
<Gauche プルリクエスト #558 測定結果> | |
https://github.com/shirok/Gauche/pull/558 | |
測定用のスクリプトは下に添付します ( handle_vals.scm ) 。 | |
(1) 変更前 (for + local allay) | |
values-0 : #<time-result 3000000 times/ 6.818 real/ 7.547 user/ 0.781 sys> | |
values-1 : #<time-result 3000000 times/ 7.043 real/ 8.000 user/ 0.875 sys> | |
values-2 : #<time-result 3000000 times/ 7.245 real/ 8.000 user/ 0.640 sys> | |
values-3 : #<time-result 3000000 times/ 7.368 real/ 8.016 user/ 0.718 sys> | |
values-4 : #<time-result 3000000 times/ 7.518 real/ 7.905 user/ 0.813 sys> | |
values-5 : #<time-result 3000000 times/ 7.668 real/ 8.359 user/ 0.890 sys> | |
values-10: #<time-result 3000000 times/ 8.381 real/ 9.360 user/ 1.032 sys> | |
values-15: #<time-result 3000000 times/ 9.164 real/ 10.484 user/ 1.125 sys> | |
values-20: #<time-result 3000000 times/ 9.873 real/ 10.734 user/ 1.656 sys> | |
(2) 変更後 (memcpy + malloc) | |
values-0 : #<time-result 3000000 times/ 6.859 real/ 7.234 user/ 0.750 sys> | |
values-1 : #<time-result 3000000 times/ 7.070 real/ 7.640 user/ 0.641 sys> | |
values-2 : #<time-result 3000000 times/ 7.398 real/ 8.140 user/ 0.734 sys> | |
values-3 : #<time-result 3000000 times/ 7.522 real/ 8.048 user/ 0.891 sys> | |
values-4 : #<time-result 3000000 times/ 7.789 real/ 8.501 user/ 0.984 sys> | |
values-5 : #<time-result 3000000 times/ 7.910 real/ 8.890 user/ 0.937 sys> | |
values-10: #<time-result 3000000 times/ 8.814 real/ 9.719 user/ 1.203 sys> | |
values-15: #<time-result 3000000 times/ 9.663 real/ 10.953 user/ 1.359 sys> | |
values-20: #<time-result 3000000 times/ 10.520 real/ 12.813 user/ 1.688 sys> | |
(3) 別案 A (memcpy + local array) | |
values-0 : #<time-result 3000000 times/ 6.832 real/ 7.438 user/ 0.687 sys> | |
values-1 : #<time-result 3000000 times/ 7.089 real/ 6.750 user/ 0.984 sys> | |
values-2 : #<time-result 3000000 times/ 7.276 real/ 7.687 user/ 0.781 sys> | |
values-3 : #<time-result 3000000 times/ 7.375 real/ 8.172 user/ 0.797 sys> | |
values-4 : #<time-result 3000000 times/ 7.544 real/ 7.687 user/ 1.000 sys> | |
values-5 : #<time-result 3000000 times/ 7.691 real/ 8.062 user/ 0.953 sys> | |
values-10: #<time-result 3000000 times/ 8.419 real/ 9.437 user/ 1.063 sys> | |
values-15: #<time-result 3000000 times/ 9.133 real/ 9.234 user/ 1.469 sys> | |
values-20: #<time-result 3000000 times/ 9.781 real/ 10.842 user/ 1.500 sys> | |
(4) 別案 B (for + malloc) | |
values-0 : #<time-result 3000000 times/ 6.832 real/ 7.453 user/ 0.719 sys> | |
values-1 : #<time-result 3000000 times/ 7.084 real/ 9.844 user/ 0.188 sys> | |
values-2 : #<time-result 3000000 times/ 7.349 real/ 7.922 user/ 0.812 sys> | |
values-3 : #<time-result 3000000 times/ 7.476 real/ 8.000 user/ 0.828 sys> | |
values-4 : #<time-result 3000000 times/ 7.741 real/ 8.204 user/ 0.938 sys> | |
values-5 : #<time-result 3000000 times/ 7.960 real/ 9.015 user/ 0.828 sys> | |
values-10: #<time-result 3000000 times/ 8.819 real/ 9.656 user/ 1.359 sys> | |
values-15: #<time-result 3000000 times/ 9.725 real/ 10.657 user/ 1.468 sys> | |
values-20: #<time-result 3000000 times/ 10.626 real/ 11.969 user/ 1.844 sys> | |
(2019-12-22) |
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
(use gauche.time) | |
(define v1 (vector-tabulate 21 (lambda (i) (iota i)))) | |
(define (handle-values n) | |
(with-error-handler | |
(lambda (e) (apply values (vector-ref v1 n))) | |
(lambda () (raise 1000)))) | |
#;(let () | |
(receive ret (handle-values 0) (print ret)) | |
(receive ret (handle-values 1) (print ret)) | |
(receive ret (handle-values 2) (print ret)) | |
(receive ret (handle-values 20) (print ret)) | |
(exit)) | |
(print "values-0 : " (time-this 3000000 (lambda () (handle-values 0)))) | |
(print "values-1 : " (time-this 3000000 (lambda () (handle-values 1)))) | |
(print "values-2 : " (time-this 3000000 (lambda () (handle-values 2)))) | |
(print "values-3 : " (time-this 3000000 (lambda () (handle-values 3)))) | |
(print "values-4 : " (time-this 3000000 (lambda () (handle-values 4)))) | |
(print "values-5 : " (time-this 3000000 (lambda () (handle-values 5)))) | |
(print "values-10: " (time-this 3000000 (lambda () (handle-values 10)))) | |
(print "values-15: " (time-this 3000000 (lambda () (handle-values 15)))) | |
(print "values-20: " (time-this 3000000 (lambda () (handle-values 20)))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment