Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Vladimir Sedach
storage
Commits
8c5fe050
Commit
8c5fe050
authored
Dec 21, 2011
by
Stas Boukarev
Browse files
Add some benchmarks.
parent
b763167d
Changes
1
Hide whitespace changes
Inline
Side-by-side
benchmarks.lisp
0 → 100644
View file @
8c5fe050
(
in-package
#:storage
)
;;; conses
(
defvar
*test-file*
#p"/tmp/test.db"
)
(
defun
save-test
(
type
amount
&key
object-size
)
(
let
((
object
(
create-test-object
type
:object-size
object-size
)))
(
with-io-file
(
stream
*test-file*
:direction
:output
:size
(
+
(
object-size
amount
)
(
*
(
object-size
object
)
amount
)))
(
write-object
amount
stream
)
(
loop
repeat
amount
do
(
write-object
object
stream
)))))
(
defun
load-test
()
#+
sbcl
(
sb-ext:gc
:full
t
)
(
with-io-file
(
stream
*test-file*
)
(
time
(
loop
repeat
(
read-next-object
stream
)
do
(
read-next-object
stream
)))))
(
defgeneric
create-test-object
(
type
&key
&allow-other-keys
))
(
defmethod
create-test-object
((
type
(
eql
'cons
))
&key
object-size
)
(
make-list
(
or
object-size
10000
)
:initial-element
nil
))
(
defun
class-preallocation-test
(
storage
)
(
loop
for
class
in
(
storage-data
storage
)
for
length
=
(
length
(
objects-of-class
class
))
when
(
plusp
length
)
collect
(
cons
class
length
)
into
info
and
sum
length
into
array-length
finally
(
preallocate-objects
(
setf
*indexes*
(
make-array
array-length
))
info
)))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment