Plaster
New
List
Login
text
apl
aspx
asterisk
brainfuck
c
c++hdr
c++src
cassandra
ceylon
clojure
clojurescript
cmake
cobol
coffeescript
common-lisp
crystal
csharp
css
cypher-query
cython
d
dart
diff
django
dockerfile
dylan
ebnf
ecl
ecmascript
edn
eiffel
ejs
elm
erb
erlang
ez80
factor
fcl
feature
forth
fortran
fragment
gfm
go
gql
groovy
gss
haml
handlebars-template
haskell
haxe
hive
html
http
httpd-php
httpd-php-open
hxml
ini
java
javascript
json
jsp
jsx
julia
kotlin
latex
less
literate-haskell
lua
mariadb
markdown
mbox
mirc
mscgen
msgenny
mssql
mumps
mysql
n-triples
nesc
nginx-conf
nsis
objectivec
octave
oz
pascal
perl
pgp
pgp-keys
pgp-signature
pgsql
php
pig
plsql
properties
protobuf
puppet
python
q
rpm-changes
rpm-spec
rsrc
ruby
rustsrc
sas
sass
scala
scheme
scss
sieve
slim
smarty
solr
soy
sparql-query
spreadsheet
sql
squirrel
stex
styl
swift
systemverilog
tcl
textile
tiddlywiki
tiki
tlv
tornado
ttcn-asn
ttcn-cfg
turtle
twig
typescript
typescript-jsx
vb
vbscript
velocity
verilog
vertex
vhdl
vue
webidl
xml
xml-dtd
xquery
xu
yaml
z80
default
Visibility:
public
unlisted
private
(require :closer-mop) (defvar *number-of-classes* (read-from-string (first (uiop:command-line-arguments)))) (defgeneric test-gf (x)) ;; Define N metaclasses. (time (dotimes (n *number-of-classes*) (let ((metaclass (closer-mop:ensure-class (intern (format nil "DUMMY-~A-METACLASS" n)) :direct-superclasses (list (find-class 'standard-class))))) (closer-mop:ensure-method #'closer-mop:validate-superclass '(lambda (x y) t) :specializers (list metaclass (find-class 'standard-class)))))) ;; Define N classes, each with its own metaclass. (time (dotimes (n *number-of-classes*) (closer-mop:ensure-class (intern (format nil "DUMMY-~A" n)) :metaclass (find-class (intern (format nil "DUMMY-~A-METACLASS" n)))))) ;; Add a simple method to TEST-GF for each class. (time (dotimes (n *number-of-classes*) (closer-mop:ensure-method #'test-gf '(lambda (x) x) :specializers (list (find-class (find-symbol (format nil "DUMMY-~A" n))))))) (uiop:quit) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $ sbcl --noinform --load metaclass-test.lisp 50 Evaluation took: 1.217 seconds of real time 1.215384 seconds of total run time (1.179393 user, 0.035991 system) [ Run times consist of 0.063 seconds GC time, and 1.153 seconds non-GC time. ] 99.84% CPU 206 lambdas converted 4,004,523,692 processor cycles 262,675,120 bytes consed Evaluation took: 0.006 seconds of real time 0.006506 seconds of total run time (0.006506 user, 0.000000 system) 116.67% CPU 21,411,592 processor cycles 1,079,040 bytes consed Evaluation took: 0.042 seconds of real time 0.042552 seconds of total run time (0.042552 user, 0.000000 system) 102.38% CPU 150 lambdas converted 140,397,344 processor cycles 10,434,992 bytes consed ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $ sbcl --noinform --load metaclass-test.lisp 100 Evaluation took: 12.722 seconds of real time 12.718115 seconds of total run time (12.542279 user, 0.175836 system) [ Run times consist of 0.346 seconds GC time, and 12.373 seconds non-GC time. ] 99.97% CPU 356 lambdas converted 41,889,728,388 processor cycles 1,832,604,752 bytes consed Evaluation took: 0.013 seconds of real time 0.012836 seconds of total run time (0.012836 user, 0.000000 system) 100.00% CPU 42,254,780 processor cycles 2,257,792 bytes consed Evaluation took: 0.598 seconds of real time 0.598378 seconds of total run time (0.594366 user, 0.004012 system) [ Run times consist of 0.009 seconds GC time, and 0.590 seconds non-GC time. ] 100.00% CPU 300 lambdas converted 1,970,283,672 processor cycles 27,223,792 bytes consed