Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7932559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:03:27+00:00 2026-06-03T21:03:27+00:00

This works, but I’m curious what the performance penalty is for dynamically passing in

  • 0

This works, but I’m curious what the performance penalty is for dynamically passing in a namespace and resolving it using ns-resolve…

(ns bulbs.vertices)

(defn create
  [config data]
  ((ns-resolve (:ns config) 'create-vertex) config data))

And then call it like this…

(ns bulbs.neo4jserver.graph
  (:require [bulbs.vertices :as vertices])
  (:require [bulbs.neo4jserver.client :as client]))

(defn graph
  [& [config]]
  (let [config (client/build-config config {:ns 'bulbs.neo4jserver.client})]
    (fn [func & args]
      (apply func config args))))

(def g (graph))

(g vertices/create {:name "James"})
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T21:03:28+00:00Added an answer on June 3, 2026 at 9:03 pm

    unless your ns-resolve is part of a loop (and unless you need to dynamically resolve a different function in every iteration there is absolutely no need for this), I wouldn’t worry about a performance penalty.

    But yes, there is a performance penalty:

    user=> (time (dotimes [n 1000000] (let [f (ns-resolve 'clojure.core 'inc)] (f n))))
    "Elapsed time: 175.386 msecs"
    nil
    user=> (time (dotimes [n 1000000] (let [f inc] (f n))))
    "Elapsed time: 27.022 msecs"
    nil
    

    If you really really really need the ns-resolve magic (but see the replies to your other question discouraging you from doing this in your particular situation), and if the function you’re resolving is used in a loop, take the resolve out of that loop:

    user=> (time (let [f (ns-resolve 'clojure.core 'inc)] (dotimes [n 1000000] (f n))))
    "Elapsed time: 48.538 msecs"
    nil
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I always thought I understood how this works...but lately I have started really using
This works but of course is a bit redundant. Items can also be dynamically
(Citing source at: http://jqueryui.com/demos/dialog/#modal-form ) As an example, this works great but each time
I use the line below in my C# winform app, this works great but
I'm sure this works in VS2010 but is there any way to get snippets
$.post($(this).attr(action), $(this).serialize(), function(json) { alert('red'); AddItemAjax(json); }, json); This works in Chrome but not
Why doesn't this work <script src=jquery.js/> But this works <script src=jquery.js></script> ? Firefox 3.5.8
This works perfectly in Firefox but doesnt work in ie i get the following
This works perfectly fine on localhost but doesn't work on my server, could anyone
This works in Firefox and Chrome, but fails in IE. It does show results

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.