[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] [PATCH] Improve srfi-13 performance quite a bit by inl
From: |
Peter Bex |
Subject: |
[Chicken-hackers] [PATCH] Improve srfi-13 performance quite a bit by inlining optarg handling |
Date: |
Fri, 27 Sep 2019 19:18:37 +0200 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
Hi all,
Attached is a relatively straightforward patch for SRFI-13. It changes
the let-string-start+end macro (and also let-string-start+end2 but that
isn't exported) so that it uses let-optionals* and the entire picking
apart of the rest arg list into start/end can be completely inlined,
as well as checking the values against the string length(s).
The old version was written in terms of the awkward string-parse-start+end
and string-parse-final-start+end procedures, which could of course not be
inlined.
The performance benefit seems to be quite a bit: total runtime of the
srfi-13 benchmark suite in chicken-benchmarks went from 58s to 36s.
Here's the cpu time (right is with patch, left without. Higher numbers
are better):
===
=== cpu-time
===
Programs [1] [2]
========================================
string-ci-equal___________1.00______2.39
string-concatenate________1.00______1.00
string-contains___________1.00______2.45
string-contains-ci________1.00______2.22
string-drop_______________1.00______1.00
string-drop-right_________1.00______1.00
string-equal______________1.00______2.37
string-join_______________1.00______1.00
string-prefix_____________1.00______1.85
string-prefix-ci__________1.00______1.80
string-suffix_____________1.00______1.83
string-suffix-ci__________1.00______1.74
string-take_______________1.00______1.01
string-take-right_________1.00______1.01
NOTE: The moving of the ##sys#check-fixnum calls in string-pad,
string-pad-right, string-hash and string-hash-ci are not strictly
needed to improve the performance with current CHICKEN, but they are
useful for a patch I'm working on which eliminates the need to cons up
a rest list for optional arguments.
This also applies to the note I added regarding complex expressions.
Feel free to remove it.
Cheers,
Peter
srfi-13.patch
Description: Text Data
signature.asc
Description: PGP signature
- [Chicken-hackers] [PATCH] Improve srfi-13 performance quite a bit by inlining optarg handling,
Peter Bex <=
- Re: [Chicken-hackers] [PATCH] Improve srfi-13 performance quite a bit by inlining optarg handling, felix . winkelmann, 2019/09/27
- Re: [Chicken-hackers] [PATCH] Improve srfi-13 performance quite a bit by inlining optarg handling, Jörg F. Wittenberger, 2019/09/28
- Re: [Chicken-hackers] [PATCH] Improve srfi-13 performance quite a bit by inlining optarg handling, Matt Welland, 2019/09/28
- Re: [Chicken-hackers] [PATCH] Improve srfi-13 performance quite a bit by inlining optarg handling, Vasilij Schneidermann, 2019/09/28
- Re: [Chicken-hackers] [PATCH] Improve srfi-13 performance quite a bit by inlining optarg handling, Kon Lovett, 2019/09/28
- Re: [Chicken-hackers] [PATCH] Improve srfi-13 performance quite a bit by inlining optarg handling, Ivan Raikov, 2019/09/29
- Re: [Chicken-hackers] [PATCH] Improve srfi-13 performance quite a bit by inlining optarg handling, Peter Bex, 2019/09/29
- Re: [Chicken-hackers] [PATCH] Improve srfi-13 performance quite a bit by inlining optarg handling, felix . winkelmann, 2019/09/28
- Re: [Chicken-hackers] [PATCH] Improve srfi-13 performance quite a bit by inlining optarg handling, felix . winkelmann, 2019/09/29