SBCLのremove-duplicatesについて。 remove-duplicatesは常に${O}(N^2)$と思っていたのだけど、${O}(N)$の場合もあることを知った。[1] 具体的には、 入力がリストで keyとtest-notが与えられていなくて testがeq・eql・equal・equalpのどれか である場合にハッシュテーブルが使われて${O}(N)$になる。 自分が必ず${O}(N^2)$になると思いこんでいたのはCLHSの次の記述 The elements of sequence are compared pairwise, and if any two match, then the one occurring earlier in sequence is discarded, unless from-end is true, in which case the
Intro, overviewThis document comes in three parts: an introduction into basic tradeoffs in GC design (speed in different places, RAM usage, safety etc)a description of what SBCL on amd64 does right now, what LLVM offers (or wants to offer) and how they map to each otherme mumbling that LLVM’s current constraints allow me to implement a good garbage collection, it also prevents me from pickup many
sb-c:define-source-transformの使い方について。 例えば、動的なmodに対しての掛け算mod*を定義したいとする: (declaim ((unsigned-byte 32) *modulus*)) (defvar *modulus*) (defun mod* (&rest args) (reduce (lambda (x y) (mod (* x y) *modulus*)) args :initial-value 1)) (ここでは演算の性質は問題にしない。)この mod*はどんな引数に対してもいちいちreduceを呼ぶし、modや*も引数の型に特定化されないのであまり効率が良くない。多くの場合、このような問題はインライン宣言で解決する。しかしこの場合については、mod*をインライン化することでargsの長さなどがコンパイル時に確定できても、*とmodを使ったフ
MAKE-INSTANCE optimizations # hacking, June 29th 2009 SBCL has always had a fairly efficient MAKE-INSTANCE — as long as the class argument is a quoted symbol and all the keywords in initargs are constant as well. This is due to what are called ctors. Very briefly, a call such as (make-instance 'point :x x :y y) is transformed into something along the lines of (let ((#:ctor (load-time-value (ensure
This Stack Overflow post points out an obscure and undocumented weakness in Intel’s implementation of the POPCNT instruction: although the population count (number of bits equal to 1) is only a function of the source argument, hardware schedules it as though it also depended on the destination. GCC, clang and MSVC all fail to take this issue into account. Until a new patched version of my favourit
SBCL 1.0.5.28 includes an experimental code coverage tool (sb-cover) as a new contrib module. Basically you just need to compile your code with a special optimize proclamation, load it, run some tests, and then run a reporting utility. The reporting utility will produce some html files. One will contain an aggregate coverage report of your whole system, the others will show your source code transf
(defparameter *ma* (make-matrix 500 500)) (defparameter *mb* (make-matrix 500 500)) (defparameter *mc* (make-matrix 500 500)) (defun simple-gemm (ma mb mc) (declare (optimize (speed 3) (debug 0) (safety 0))) (declare (type matrix ma mb mc)) (let ((rows (array-dimension ma 0)) (cols (array-dimension mb 1))) (declare (type fixnum rows cols)) (dotimes (row rows) (dotimes (col cols) (dotimes (k cols)
; 780: L2: 498B5011 MOV RDX, [R8+17] ; 784: F30F10545A01 MOVSS XMM2, [RDX+RBX*2+1] ; 78A: F30F59D1 MULSS XMM2, XMM1 ; 78E: 488B5011 MOV RDX, [RAX+17] ; 792: F30F105C4A01 MOVSS XMM3, [RDX+RCX*2+1] ; 798: F30F58DA ADDSS XMM3, XMM2 ; 79C: 488B5011 MOV RDX, [RAX+17] ; 7A0: F30F115C4A01 MOVSS [RDX+RCX*2+1], XMM3 ; 7A6: 488D5102 LEA RDX, [RCX+2] <<<< ; 7AA: 4C8D5302 LEA R10, [RBX+2] <<<< ; 7AE: 4D8B6811
(:meta ((:this “Lisp Advent Calendar 2014の3日目の記事”) (:prev (:author “tk_riple” :title “時の羅針盤@blog: R7RSポータブルライブラリを書く際の落とし穴”)) (:next (:author “nobkz” :tite “Shenの基礎その1 基本的な型 - Qiita”)))) κeenです。さっきまでVOPで遊んでたので当初の予定を変更してVOPの話をします。 VOPとは何か SBCLやCMU CLで使われているネイティブコードを吐くための機構、要はインラインアセンブラです。 VOPとはどんなものか とりあえずコードをば。x86-64用です。 (in-package :cl-user) (defpackage vop-sample (:use :cl :sb-ext :sb-c)) (in-pac
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く