skypher / cl-store Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
README for Package CL-STORE. Author: Sean Ross Homepage: http://www.common-lisp.net/project/cl-store/ Version: 0.8.11 0. About. CL-STORE is an portable serialization package which should give you the ability to store all common-lisp data types (well not all yet) into streams. See the cl-store manual (docs/cl-store.texi) for more in depth information. !!! NOTE: The cl-store-xml backend is deprecated. 1. Usage The main entry points are - [Method] cl-store:store (obj place &optional (backend *default-backend*)) => obj Where place is a path designator or stream and backend is one of the registered backends. - [Method] cl-store:restore (place &optional (backend *default-backend*)) => restored-objects Where place and backend is as above. - cl-store:restore is setfable, which I think makes for a great serialized hit counter. eg. (incf (restore place)) NOTE. All errors signalled within store and restore can be handled by catching store-error and restore-error respectively. 2. Optimizing. While cl-store is generally quickish it still has a tendency to do a lot of consing. Thanks to profilers this has been pinned down to the rehashing of the hash-tables which track object circularities. From 0.4.0 cl-store has three new variables *store-hash-size*, *restore-hash-size* and *check-for-circs*, proper usage of these new variables can greatly reduce the consing (and time taken) when storing and restoring large objects. - *store-hash-size* and *restore-hash-size At the beginning of storing and restoring an eq hash-table is created with a default size of 50 to track objects which have been (re)stored. On large objects however the rehashing of these hash-tables imposes a severe drain on performance. By binding these two variables to appropriately large values about (100010 for a hash-table with 100000 int->string mappings) you can obtain a decent performance improvement. This may require a bit of fiddling to find the best tradeoff between rehashing and creating a large hash-table. - *check-for-circs* Binding this variable to nil when storing or restoring an object inhibits all checks for circularities which gives a severe boost to performance. The downside of this is that no restored objects will be eq and attempting to store circular objects will hang. The speed improvements are definitely worth it if you know that there will be no circularities or shared references in your data (eg spam-filter hash-tables). Enjoy Sean.
SBCL internals related to structures have changed, breaking cl-store, in particular, the struct-class.1 test.
;; I create two atoms and create a bond between them, when I cl-store:restore them the bonded atoms are duplicated.
cl-store:check-for-circs ;; --> T
(defstruct name bond)
(progn
(setq h1 (make- :name "H1"))
(setq h2 (make- :name "H2"))
(setf (-bond h1) h2)
(setf (-bond h2) h1))
(progn
(setq m (flexi-streams:make-in-memory-output-stream))
(cl-store:store h1 m)
(cl-store:store h2 m))
(setq in-vec (flexi-streams:get-output-stream-sequence m))
(setq in (flexi-streams:make-in-memory-input-stream in-vec))
(progn
(setq rh1 (cl-store:restore in))
(setq rh2 (cl-store:restore in))
)
(-name rh1)
(-name rh2)
(eq (-bond rh1) rh2) ;; --> NIL
(eq (-bond h1) h2) ;; --> T
I have to :use "#:clos" in depackage, it does not import-from #:clos in case of #+ecl.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.