Summary
read-char could be better optimized
Metadata
- Id: de33dbc99322419dda253c7f582b6411b92929ed
- Trac id: 1219
- Type: enhancement
- Reporter: sjamaan
- Owner:
- Cc:
- Status: closed
- Component: scrutinizer
- Estimated difficulty:
- Resolution: fixed
- Priority: major
- Milestone: 5.0
- Version: 4.9.x
- Changetime: 2016-01-11 09:01:49 UTC
- Created: 2015-09-07 21:06:48 UTC
- Keywords:
Description
Currently, there are two issues with read-char:
- It calls ##sys#read-char/port, which is itself a CPS procedure (consuming needless CPU cycles and stack). This will get rewritten in c-platform.scm to a direct call to ##sys#read-char/port with fixed argcount. Is omitting argcount check really that much faster? Why not rewrite it to the complete body of ##sys#read-char/port instead?
- Equally important, the ##sys#check-input-port call in ##sys#read-char/port is not being specialized, even though there's an entry in types.db(!) This also causes an extra needless CPS call, because it can (and should) be inlined.
Once this is fixed, we should run the slatex, kernwyk-wc and kernwyk-cat benchmarks to see how much of an improvement this is.
Changes and comments
[2015-09-07 21:07:31 UTC] sjamaan changed type from defect to enhancement
[2015-09-07 21:07:31 UTC] sjamaan changed component from unknown to scrutinizer
[2015-09-07 21:07:31 UTC] sjamaan changed milestone from someday to 5.0
[2015-09-27 17:58:54 UTC] sjamaan wrote:
The reason this happens seems to be because redefinitions of core forms are not always specialized (and that's usually correct in user code). The definition of ##sys#check-input-port occurs somewhere at the top of library.scm, which means specialization of later uses is invalidated.
[2015-10-31 21:14:42 UTC] sjamaan wrote:
See also #745
[2016-01-11 09:01:49 UTC] sjamaan changed status from new to closed
[2016-01-11 09:01:49 UTC] sjamaan set resolution to fixed
[2016-01-11 09:01:49 UTC] sjamaan wrote:
This has been fixed by 5fcf890d6a724da6d7eac2f7beee19aa6832c80f + 6b33edffd9ecac963466afda388a7c49ffba0108 / a8f97697496856c2675964b5c3658276b8f33466 + a1a0ab93968ac26fb112c864398de73c2264b494.