Hi Mike, some numbers on my 2012 MacBook Air (i7):
Making a new namespace that requires gg4clj, in a newly started Gorilla REPL session (i.e. a newly started JVM): (time (ns test (:require [gg4clj.core :as gg4clj]))) takes ~80ms. If I add [clojure.core.matrix :as matrix] to the :require vector of the gg4clj.core namespace, then the form above takes ~8200ms to evaluate. Interestingly, if I only require [clojure.core.matrix.protocols :as cmp] then I find it takes ~3500ms, which seems like a very long time given the minimal amount of code in, and referred to, by that namespace. Is this what you'd expect, or am I doing something dopey? Reason I'm fussing about the load time is that already the time it takes from wanting to make a plot to getting Gorilla running is uncomfortably long. And I've been thinking recently about how it might be made quicker. So, I'm not too keen on anything that makes it longer! (This would add about 50% to the Gorilla start-up-to-plot time as it stands, which on my machine is about 14s currently). So, assuming I'm not doing something silly, could we maybe think of any easy ways to reduce the load time in a case like this, where the functions might never be used? That might be a useful thing to do anyway if the c.m dataset API is becoming a standard. [Probably not the right answer here, but in Gorilla REPL, the rendering protocol lives in its own project gorilla-renderable, which has all of about 5 lines of code. This gives a way for other code to add Gorilla renderers without having to depend on Gorilla REPL itself (which has many dependencies).] Jony On Monday, 29 December 2014 03:02:47 UTC, Mikera wrote: > > core.matrix isn't that big of a dependency itself - it only gets expensive > in/when you load the implementations (NDArray, vectorz-clj, Clatrix etc.). > Which should be a choice of the ultimate user. > > It is possible to just depend on the protocols, but I think that risks > breakage since protocols are really just an implementation detail. Best to > depend on the API in clojure.core.matrix (which are mostly just simple > functions that delegate to the right protocols) > > On Sunday, 28 December 2014 23:42:18 UTC+8, Jony Hudson wrote: >> >> @Chris Thanks, hope it's useful for you. I might have a play with ggvis >> and see how it works out. >> >> @Mike Yeah, it would definitely be good to support core.matrix datasets. >> One thing that would be nice would be to avoid the overhead of loading all >> of core.matrix for those that don't use it. Do you think it would work to >> just have gg4clj depend on the 'protocols' ns in core.matrix? Would be very >> happy to take a PR if you've got time to look at it :-) >> >> >> Jony >> >> On Friday, 26 December 2014 15:36:42 UTC, Jony Hudson wrote: >>> >>> Hi all, >>> >>> from the README: >>> >>> gg4clj is a lightweight wrapper to make it easy to use R's ggplot2 >>>> library from Clojure. It provides a straightforward way to express R code >>>> in Clojure, including easy mapping between Clojure data and R's >>>> data.frame, >>>> and some plumbing to send this code to R and recover the rendered >>>> graphics. >>>> It also provides a Gorilla REPL renderer plugin to allow rendered plots to >>>> be displayed inline in Gorilla worksheets. It is not a Clojure rewrite of >>>> ggplot2 - it calls R, which must be installed on your system (see below), >>>> to render the plots. You'll need to be familiar with R and ggplot2, or >>>> else >>>> the commands will seem fairly cryptic. >>> >>> >>> Demo worksheet, showing it in action here: >>> http://viewer.gorilla-repl.org/view.html?source=github&user=JonyEpsilon&repo=gg4clj&path=ws/demo.clj >>> Source here: https://github.com/JonyEpsilon/gg4clj >>> >>> Works better than I thought it would! >>> >>> >>> Jony >>> >> -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.