Opened 9 years ago
Closed 9 years ago
#1219 closed enhancement (fixed)
read-char could be better optimized
Reported by: | sjamaan | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 5.0 |
Component: | scrutinizer | Version: | 4.9.x |
Keywords: | Cc: | ||
Estimated difficulty: |
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 inc-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 intypes.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.
Change History (4)
comment:1 Changed 9 years ago by
Component: | unknown → scrutinizer |
---|---|
Milestone: | someday → 5.0 |
Type: | defect → enhancement |
comment:2 Changed 9 years ago by
comment:4 Changed 9 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
This has been fixed by 5fcf890d6a724da6d7eac2f7beee19aa6832c80f + 6b33edffd9ecac963466afda388a7c49ffba0108 / a8f97697496856c2675964b5c3658276b8f33466 + a1a0ab93968ac26fb112c864398de73c2264b494.
Note: See
TracTickets for help on using
tickets.
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 oflibrary.scm
, which means specialization of later uses is invalidated.