-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEF-COLUMN-STRUCT with one or two allocation levels.
Quite a few things still missing, see TODOs.
- Loading branch information
Showing
21 changed files
with
1,358 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
* | ||
*.d | ||
*.dSYM | ||
*.o | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
|
||
|
||
(require :sb-perf) | ||
|
||
(require :sb-udef-inttype) | ||
|
||
#. (let ((what (second sb-ext:*posix-argv*))) | ||
(defparameter *def* (if (string= what "1") | ||
'defstruct | ||
'sb-column-struct:def-column-struct)) | ||
(defparameter *name* (cond | ||
((string= what "1") | ||
'my-integers) | ||
;; Sized up a few times, reaches *max* more or less exactly. | ||
((string= what "2") | ||
'(my-integers (:initial-size 16500) | ||
(:data-var var))) | ||
((string= what "3") | ||
'(my-integers (:initial-size 2030000) | ||
(:data-var var))) | ||
((string= what "4") | ||
'(my-integers (:initial-size 3000000) | ||
(:batched 1000001) | ||
(:data-var var)))))) | ||
|
||
#+(or) | ||
(setf *name* '(my-integers (:initial-size 30) | ||
(:batched 10) | ||
(:data-var var))) | ||
|
||
(#. *def* #. *name* | ||
(prev nil :type t) | ||
(v1 0 :type fixnum) | ||
(v2 0 :type fixnum)) | ||
|
||
;; Only now, to have the accessors available | ||
(sb-perf:write-perfmap) | ||
|
||
#+(or) | ||
(unless (eq *def* 'defstruct) | ||
(format t "Start size: ~d of ~d~%" | ||
(sb-column-struct:column-struct-last-index 'my-integers) | ||
(sb-column-struct:column-struct-size 'my-integers))) | ||
|
||
|
||
(defparameter *max* 8000000) | ||
|
||
|
||
(defparameter *data* (loop for i from 0 to *max* | ||
for instance = (make-my-integers :prev instance | ||
:v1 i) | ||
do (setf (my-integers-v2 instance) | ||
(mod i 37)) | ||
finally (return instance))) | ||
|
||
;; TODO: broken | ||
#+(or) | ||
(unless (eq *def* 'defstruct) | ||
(describe *data*)) | ||
|
||
;; check content | ||
(defun check () | ||
(loop with instance = *data* | ||
for i from *max* downto 0 | ||
unless (eq *def* 'defstruct) | ||
do (multiple-value-bind (type raw) | ||
(sb-impl::udef-inttype-type-of instance) | ||
(assert (eq type 'my-integers)) | ||
(assert (= raw i))) | ||
;; | ||
do (assert (= (my-integers-v1 instance) | ||
i)) | ||
do (assert (= (my-integers-v2 instance) | ||
(mod i 37))) | ||
do (setf instance (my-integers-prev instance)) | ||
;if (zerop (mod i 100000)) | ||
;do (format t " okay for ~d~%" i) | ||
finally (assert (null instance)))) | ||
|
||
|
||
(defun sizes () | ||
(if (eq *def* 'defstruct) | ||
(format t " Created: ~d~%" (my-integers-v1 *data*)) | ||
(format t " Used items: ~d of ~d~%" | ||
(sb-column-struct:column-struct-last-index 'my-integers) | ||
(sb-column-struct:column-struct-size 'my-integers)))) | ||
|
||
(check) | ||
|
||
(let ((file (third sb-ext:*posix-argv*))) | ||
(unless (member file '(nil "" "-") :test #'equal) | ||
(save-lisp-and-die file | ||
:executable t | ||
:toplevel #'sizes))) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
;;;; SB-Perf | ||
|
||
(error "Can't build contribs with ASDF") | ||
|
||
(defsystem "sb-udef-inttype" | ||
:components ((:file "column-structure") | ||
;example-column-structure.lisp | ||
;example.lisp | ||
;simple.lisp | ||
;test.lisp | ||
)) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.