Giter Site home page Giter Site logo

Use in production? about scope-capture HOT 4 OPEN

vvvvalvalval avatar vvvvalvalval commented on May 27, 2024 1
Use in production?

from scope-capture.

Comments (4)

vvvvalvalval avatar vvvvalvalval commented on May 27, 2024 1

I have no absolute recommendation, but here are some things to consider:

Is it safe to include scope-capture to our code base ?

  1. Forgetting a (sc.api/spy ...) call somewhere in your code is a fantastic way to get a memory leak, since each recorded scope gets saved in a global atom and won't get garbage-collected.
  2. Of course, this issue might be less problematic if your program is typically short-lived and accumulating garbage can't do much harm.
  3. Personally, I'm very forgetful, so to guard against this sort of mistake I don't even include the dependency in production.
  4. You might make a different choice; just be careful, and consider using sc.api/dispose-all! to clean up after yourself.

Is there a way to dynamically load scope-capture ?

I guess the situation for scope-capture is the same as for any dependency-free Clojure library:

  1. Wherever you can get a REPL running, it's theoretically possible to load scope-capture dynamically (proof: you can just eval each source file in dependency order). In practice, depending on your tooling / setup, that might be more or less tedious. I reckon it works out-of-the-box in Cursive. I've never tried though.
  2. AFAICT, it's almost certainly impossible to do in advanced-compiled ClojureScript.

Does that answer your questions @viebel ?

from scope-capture.

gphilipp avatar gphilipp commented on May 27, 2024

I’ve never used it in production, but in staging yes. As long as it’s on the classpath when the process is started you can just repl in and require it from any namespace.

from scope-capture.

vemv avatar vemv commented on May 27, 2024

@vvvvalvalval : for completeness, other than a plain' ol mem leak (due to the atom), is there any other significant impact in terms of performance or correctness?

from scope-capture.

vvvvalvalval avatar vvvvalvalval commented on May 27, 2024

is there any other significant impact in terms of performance or correctness?

@vemv for performance, nothing I can think of - the sources of overhead are the effects of saving to the atom and logging.

For correctness, the main risk is that the sc.api/spy macro does side-effects at macro-expansion. Some compilation toolchains may rely on the assumption that macro-expansion is purely functional, and thus avoid re-doing macro-expansion when you would like it to. That kind of stuff.

from scope-capture.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.