-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Caching symbol expansions outside DynamicSymbol #50
Labels
Comments
Closed
This was referenced Jul 28, 2022
edemaine
added a commit
that referenced
this issue
Aug 13, 2022
* All function mappings are now automatically dynamic; no need to wrap in a second layer of function. * Can force old static behavior (for efficiency) via `svgtiler.static` wrapper. * Support mapping defined by `Map` or `WeakMap`
edemaine
added a commit
that referenced
this issue
Aug 13, 2022
* Support mapping defined by `Map` or `WeakMap` * All function mappings are now automatically dynamic; no need to wrap in a second layer of function. * Can force old static behavior (for efficiency) via `svgtiler.static` wrapper, cached at `Mapping` level. * Function mappings get `context` second argument in addition to `this`. * `Context` object now shared throughout each drawing (so you could store extra drawing-specific data there). * API change: `Context` no longer has `symbols`, `symbol`, `data`, `filename`, or `subname` attributes. For the latter three, use `drawing.data`, `drawing.filename`, or `drawing.subname`. * API change: No more `Symbol`, `StaticSymbol`, or `DynamicSymbol` class (in particular, there was a name conflict with JS's `Symbol`) * API change: `Input` constructor supports direct loading of data (for easy manual creation) or immediate parsing of file data, as well as option setting. This will help with #34. * New `Tile` class represents an expanded (and possibly parsed) tile `<symbol>` (roughly what `Symbol` was before). * Tile caching/deduplication now within the renderer, not by `Symbol` (fix #50), enabling re-use when multiple symbols expand to the same SVG. * Fix: Don't fill in `<image>` `width`/`height` when both already set. * Fix: Use `hasOwnProperty` and `Set`s to avoid accidentally matching e.g. `toString`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, the cache for various expansions of a
DynamicSymbol
is done within theDynamicSymbol
object. But this prevents deduplication of e.g. two symbolsx-
and-x
that expand to the same SVG, for static and/or dynamic symbols.Also leads to funny behaviors where(This has been fixed by resetting the caches between different drawings.) It also means that, currently,svgtiler x.coffee a.txt b.txt
andsvgtiler x.coffee b.txt
generate differentb.svg
files.context.key
reveals the version number of aDynamicSymbol
, which may be confusing (I'd expectkey
to be the string that created the symbol, not theid
of the eventual<symbol>
).So ideally the caching and version numbering should be done at the
Drawing
level. Or perhaps a newRender
/Tiler
class that represents the rendering process for a given drawing, which might permit partial re-use of rendering for GUI (#51).Also, for GUI, need a mechanism to clear the cache, to avoid memory leaks from gradually adding more and more different instances of dynamic symbols (similar to what we do between drawings now). Related to version numbering #53
The text was updated successfully, but these errors were encountered: