Sha256: 501438659a9629ee329255dfa9394c78c314f69be616f845a99979f3a499ee5e

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

Convenience library that pulls in all standard libraries and hacks I use in quick scripts.

[ TODO

- shortcut for "@var = var" initializations; I think Rails ships it even?
- .to_i!, .max!
- a few more extensions to range_math, notably "pass method call to numbers"

]
[ Memoization

Should work like this:

- get file and body of the method to be memoized (via method_source gem)
- hash that as the method signature
- take arguments, hash them (via Ruby) (you shouldn't pass fancy arguments, only trivially hashable ones, like strings or symbols, not arrays or some custom object shit)
- save/retrieve result in/from hash (as simple pickle)
- initialize hash from database, "checkpoint.cache" and save results

- annotate all methods that can be memoized? memoize everything by default? not sure yet, but opt-in is probably the most predictable behavior

This enables checkpoint-esque behavior: any method that hasn't changed (same signature) and takes the same arguments just loads the result from a big hash instead of re-generating it every time, but any actual change will be taken into account.

The database can simply be regularly cleaned / deleted, or just discard old signatures (when initializing, look up method name -> test signature -> different? discard cache for this method)

Like:

~~~
require "muflax/checkpoint"

+Checkpoint
def method args
  ...
end

method(42)
~~~

]

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
muflax-0.1.34 README