Releases: tfeb/star
Fix declaration-raising bug
Iterator optimizers can provide type information for public bindings
Iterator optimizers are now allowed to provide type information for public bindings. For instance
(for ((i (in-naturals :bound 10 :fixnum t)))
...)
will, normally, implicitly declare i
to be of type fixnum
. This can be disabled if you really must assign values to iterator variables which are of other types.
The only standard iterator optimizer which actually does this is in-naturals
at the moment.
Experimental loop unrolling
org.tfeb.star/unroll
is built on top of Štar and will unroll loops. It turns out not to be very useful on modern hardware, but it's an example of what is possible in Lisp, at a user level, which would be extremely challenging in almost any other language.
The worse-is-better / diamond-like jewel release
This version gets rid of the in-range
iterator, which was an attempt to do a big complex system all-in-one iterator for real ranges. It was far, far too hairy, would not always produce good code and was still buggy. This is an incompatible change, although iterators have never been stable.
Instead there is a new in-naturals
iterator which provides dotimes
-style iteration over natural numbers: this is almost always all you need.
In addition, stepping
, stepping*
and stepping-values
have optimizers and can provide very fast, more general iteration.
There are some other small improvements: the preexisting 'syntax error' condition type & function is now public, and a few other small changes.
Benchmarks for loops over integers, with a recent SBCL on an M1 machine:
** range 100000, nesting 2
what seconds ratio
star/in-naturals 12.590 1.000
star/stepping 12.564 0.998
loop 12.550 0.997
dotimes 12.536 0.996
Same benchmarks with LispWorks 8.0.1 on the same hardware:
** range 100000, nesting 2
what seconds ratio
star/in-naturals 14.258 1.000
star/stepping 10.965 0.769
loop 18.421 1.292
dotimes 12.553 0.880
Štar is essentially as performant the built-in iteration constructs.
Raise declarations
Štar can now raise declarations to where they should be. This matters in nested loops:
(for* ((a (in-range 10))
(b (in-range a)))
(declare (type fixnum a b))
...)
will now raise the type declaration for a
to the outer loop. This all relies on some other declaration processing stuff from org.tfeb.hax
, so you'll need a recent version of that.
This should all be compatible.
Catchup release
Various small changes. There was no 1.1.0 release
1.0.0: because it's time
stepping*
had not been exported, and stepping
and stepping*
have a new as
option: (stepping (x :as ...))
combines initially
and then
.
But mostly I just needed to merge the branch.