chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] type-and-range-check optimizations in unsafe mode


From: Will M Farr
Subject: [Chicken-users] type-and-range-check optimizations in unsafe mode
Date: Fri, 1 Sep 2006 13:34:02 -0400

Hello all,

I've noticed with a bit more poking around the chicken runtime that there are at least two places where chicken performs "safety" checks even if you specify -unsafe (felix or others please correct me if I'm reading the code incorrectly):

- structure getters and setters
- vector-refs

There may be more places. I don't really know how much time these type checks take up---Serrano and Feeley claim in _Storage Use Analysis and its Applications_ (http://www-sop.inria.fr/mimosa/fp/ Bigloo/bigloo-5.html#Papers-&-Reports ), Section 4, that they don't take up much time *if* a compiler uses copy propogation and inlining effectively, but cite benchmarks that say 25% if the compiler doesn't. Would people be interested me going through the runtime and breaking the type-and-range checks out of procedures like vector-ref and vector-set! such that they are only performed in safe mode? The general principles I propose are:

1. C_xxx in runtime.c check as few argument types and ranges as possible consistent with genericity of operation. 2. Type and range checks are inserted in library.scm before calling C_xxxx procedures so that they are absent in the unsafe library code and in any unsafe code which inlines the library procedures (using (declare (unsafe) (usual-integrations) (inline)), would inline these I assume).

This shouldn't be too much work, and it's pretty straightforward work at that. I would be happy to implement it and submit patches if felix and others think it's OK to include. We could then check for improvement on, say, the shootout benchmarks.

Will




reply via email to

[Prev in Thread] Current Thread [Next in Thread]