source: trunk/abcl/contrib/jss/jss.asd @ 14911

Last change on this file since 14911 was 14911, checked in by Mark Evenson, 7 years ago

precompiler: possibly beta reduce form with function position lambda (Alan Ruttenberg)

Case 1: If the lambda has a single form in it, let someone define a
transform using:

define-function-position-lambda-transform (body-function-name (arglist form args) &body body)

body-function-name is the car of the single form in the lambda
arglist is the arglist of the lambda
form is the single form within the lambda
args are the arguments to which the lambda will be defined.

The function should check whether it can do a transform, and do it if
so, otherwise return nil signalling it couldn't

Case 2: If case 1 is not successful then if the arglist is a simple
one (no &key, &rest, &optional) then do a standard beta-reduction
binding the args to arglist using let (

If not, return and do the usual thing.

An example is in contrib/jss/optimize-java-call.lisp

To see benefits, (compile-file contrib/jss/test-optimize-java-call.lisp)
and then load the compiled file. You should see something like the below
which reports the timings for the optimized and unoptimized version of
10000 calls of (#"compile" 'regex.pattern ".*")


With optimization: (INVOKE-RESTARGS-MACRO "compile" (QUOTE REGEX.PATTERN) (LIST ".*") NIL T)
Without optimization: ((LAMBDA (#:G85648 &REST #:G85649) (INVOKE-RESTARGS "compile" #:G85648 #:G85649 NIL)) (QUOTE REGEX.PATTERN) ".*")

0.0 seconds real time
0 cons cells

0.011 seconds real time
0 cons cells

0.325 seconds real time
800156 cons cells

<> rdfs:seeAlso <>
<> rdfs:seeAlso <> .
<> :fixes <> .
<> :closes <> .
<> :closes <> .

File size: 745 bytes
1;;;; -*- Mode: LISP -*-
2(asdf:defsystem :jss
3  :author "Alan Ruttenberg, Mark Evenson"
4  :version "3.2.0"
5  :description "<> asdf:defsystem <>"
6  :components ((:module base
7                        :pathname "" :serial t
8                        :components ((:file "packages")
9                                     (:file "invoke")
10             (:file "optimize-java-call")
11                                     (:file "classpath")
12                                     (:file "compat")))))
14#+nil FIXME
15(asdf:defsystem :jss-tests
16  :depends-on (jss abcl abcl-test-lisp)
17  :components ((:module tests
18                        :pathname ""
19                        :components ((:file "tests")))))
Note: See TracBrowser for help on using the repository browser.