Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About optimize proclaimation #16

Open
llibra opened this issue Aug 1, 2011 · 1 comment
Open

About optimize proclaimation #16

llibra opened this issue Aug 1, 2011 · 1 comment

Comments

@llibra
Copy link

llibra commented Aug 1, 2011

CL-PATTERN has optimize proclaimation.
It causes unwanted change of compile policy at load-time.

> (declaim (optimize (speed 1) debug safety))
NIL
> (ccl:declaration-information 'optimize)
((SPEED 1) (SAFETY 3) (COMPILATION-SPEED 1) (SPACE 1) (DEBUG 3))
> (ql:quickload :cl-pattern)
To load "cl-pattern":
  Load 1 ASDF system:
    cl-pattern
; Loading "cl-pattern"

(:CL-PATTERN)
> (ccl:declaration-information 'optimize)
((SPEED 3) (SAFETY 3) (COMPILATION-SPEED 1) (SPACE 1) (DEBUG 3))

There are some better ways for optimize declaration:

;; Use declare in each functions
(defun f ()
  (declare (optimize speed))
  ...)

;; Use locally at top level and surround function definitions with it
(locally (declare (optimize speed))
  (defun x () ...)
  (defun y () ...))

;; Proclaim optimize declaration at only compile-time
(eval-when (:compile-toplevel)
  (proclaim '(optimize speed)))

References:

@m2ym
Copy link
Contributor

m2ym commented Aug 4, 2011

I had misunderstood about proclaimation. I will fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants