Ugarit
Check-in [1852ba15df]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Turns out this optimisation is a bad idea sometimes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA1:1852ba15df5fe125a74d121c7b65d08d69e8a3fa
User & Date: alaric 2020-05-25 18:15:59
Context
2020-05-25
18:15
Turns out this optimisation is a bad idea sometimes Leaf check-in: 1852ba15df user: alaric tags: trunk
2017-12-28
14:17
Updated link check-in: 391a120ae9 user: alaric tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ugarit-streams.scm.

63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
...
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195

          (flush! (lambda ()
                    (let ((keys-serialised (make-u8vector *key-buffer-bytes*)))
                      (serialise-strings! keys-serialised *key-buffer-bytes* (map car *key-buffer*))

                      (let ((hash ((vault-hash vault) keys-serialised type)))

                        (if (and *key-buffer-reused?* (vault-exists? vault hash))
                            (begin
                              (set! *key-buffer* '())
                              (set! *key-buffer-bytes* 0)
                              (set! *key-buffer-reused?* #t)
                              (vault-log-reuse! vault keys-serialised)
                              (values (reusing hash) #t)) ; We, too, are reused
                            (begin ; We are unique and new and precious!
................................................................................

                            (if (job-check-correctness? (current-job))
                                (if *key-buffer-reused?*
                                    (assert (every cdr *key-buffer*) "Key buffer thinks it's all reused, but it isn't:" *key-buffer*)
                                        ; else
                                    (assert (not (every cdr *key-buffer*)) "Key buffer thinks it's not all reused, but it is:" *key-buffer*)))

                            (if (and *key-buffer-reused?* (vault-exists? vault hash))
                                (begin
                                  (set! *sexpr-buffer* '())
                                  (set! *sexpr-buffer-bytes* 0)
                                  (set! *key-buffer* '())
                                  (set! *key-buffer-reused?* #t)
                                  (vault-log-reuse! vault serialised-buffer)
                                  (values (reusing hash) #t)) ; We, too, are reused







|







 







|







63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
...
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195

          (flush! (lambda ()
                    (let ((keys-serialised (make-u8vector *key-buffer-bytes*)))
                      (serialise-strings! keys-serialised *key-buffer-bytes* (map car *key-buffer*))

                      (let ((hash ((vault-hash vault) keys-serialised type)))

                        (if (vault-exists? vault hash)
                            (begin
                              (set! *key-buffer* '())
                              (set! *key-buffer-bytes* 0)
                              (set! *key-buffer-reused?* #t)
                              (vault-log-reuse! vault keys-serialised)
                              (values (reusing hash) #t)) ; We, too, are reused
                            (begin ; We are unique and new and precious!
................................................................................

                            (if (job-check-correctness? (current-job))
                                (if *key-buffer-reused?*
                                    (assert (every cdr *key-buffer*) "Key buffer thinks it's all reused, but it isn't:" *key-buffer*)
                                        ; else
                                    (assert (not (every cdr *key-buffer*)) "Key buffer thinks it's not all reused, but it is:" *key-buffer*)))

                            (if (vault-exists? vault hash)
                                (begin
                                  (set! *sexpr-buffer* '())
                                  (set! *sexpr-buffer-bytes* 0)
                                  (set! *key-buffer* '())
                                  (set! *key-buffer-reused?* #t)
                                  (vault-log-reuse! vault serialised-buffer)
                                  (values (reusing hash) #t)) ; We, too, are reused