Re: [ClojureScript] cljs.analyzer: how to use it?

2016-01-25 Thread Yehonathan Sharvit
I have an issue when requiring cljs.js and compiling in `:optimizations
:whitespace`
I get the following error in the browser: goog.require could not find:
cljs.core$macros

Any idea why it happens and how to solve it?


On Thu, Jan 21, 2016 at 4:21 PM, Mike Fikes  wrote:

> Hi Andray,
>
> I don’t know. I’ve always assumed eval-str treated its contents
> essentially as a top-level form. Having said that, if you have evaluated
> `def`s in your environment and maintain the analysis cache, then your
> evaluated string will “see” those `def`s.
>
> - Mike
>
> > On Jan 21, 2016, at 8:03 AM, Andray Shotkin 
> wrote:
> >
> > Mike,
> > any idea how can i pass outer variables bindings into eval-str?
> > i see :locals field in options but these locals are not forwarded into
> env which is used during analyzing clojurescript form?
> >
> > Andray
> >
> > --
> > Note that posts from new members are moderated - please be patient with
> your first post.
> > ---
> > You received this message because you are subscribed to the Google
> Groups "ClojureScript" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to clojurescript+unsubscr...@googlegroups.com.
> > To post to this group, send email to clojurescript@googlegroups.com.
> > Visit this group at https://groups.google.com/group/clojurescript.
>
> --
> Note that posts from new members are moderated - please be patient with
> your first post.
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "ClojureScript" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojurescript/5ZUvk7RPB9I/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> clojurescript+unsubscr...@googlegroups.com.
> To post to this group, send email to clojurescript@googlegroups.com.
> Visit this group at https://groups.google.com/group/clojurescript.
>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.


Re: [ClojureScript] [Ann] Planck 1.9

2016-01-25 Thread Jamie Orchard-Hays
That’s really great. Mike’s doing terrific work.

Jamie

> On Jan 25, 2016, at 4:21 AM, Karel Miarka  wrote:
> 
> On Monday, January 25, 2016 at 10:16:34 AM UTC+1, Karel Miarka wrote:
>> I'm just curious if there is any chance to run it on Linux?
>> Thanks!
> 
> The answer is probably here 
> https://twitter.com/mfikes/status/641737404018216960
> 
> -- 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> --- 
> You received this message because you are subscribed to the Google Groups 
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojurescript+unsubscr...@googlegroups.com.
> To post to this group, send email to clojurescript@googlegroups.com.
> Visit this group at https://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.


Re: [ClojureScript] [Ann] Planck 1.9

2016-01-25 Thread Mike Fikes
Yeah, I’d like Planck to work on Linux, but I haven’t been focused on it as a 
high priority.

> On Jan 25, 2016, at 4:21 AM, Karel Miarka  wrote:
> 
> On Monday, January 25, 2016 at 10:16:34 AM UTC+1, Karel Miarka wrote:
>> I'm just curious if there is any chance to run it on Linux?
>> Thanks!
> 
> The answer is probably here 
> https://twitter.com/mfikes/status/641737404018216960
> 
> -- 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> --- 
> You received this message because you are subscribed to the Google Groups 
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojurescript+unsubscr...@googlegroups.com.
> To post to this group, send email to clojurescript@googlegroups.com.
> Visit this group at https://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.


[ClojureScript] Re: [Ann] Planck 1.9

2016-01-25 Thread Karel Miarka
I'm just curious if there is any chance to run it on Linux?
Thanks!

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.


[ClojureScript] Re: [Ann] Planck 1.9

2016-01-25 Thread Karel Miarka
On Monday, January 25, 2016 at 10:16:34 AM UTC+1, Karel Miarka wrote:
> I'm just curious if there is any chance to run it on Linux?
> Thanks!

The answer is probably here https://twitter.com/mfikes/status/641737404018216960

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.


Re: [ClojureScript] Will advanced optimizations be officially supported on nodejs?

2016-01-25 Thread Moe Aboulkheir
I don't know what the official position is, but I use :advanced on nodejs a
bunch.

Take care,
Moe

On Mon, Jan 25, 2016 at 4:36 AM, Roc King  wrote:

> Hi all!
>
> It seems unclear from the quick start wiki page[1]. But in Clojurescript
> Unraveled[2], it says that :optimizations :none is *mandatory* for nodejs.
>
> Can we relay on advanced optimizations when targeting nodejs(currently or
> in the future)?
>
> Thanks in advance.
>
>
> Some reasons(other than runtime performance) to use advanced optimizations:
>
> . fast startup time and small memory footprint
> . easy to deployment
> . hard to reverse engineering
>
> without them, clojurescript + nodejs are not so attractive than clojure +
> jvm.
>
>
> The hello world program from the quick start wiki page will take half a
> second without optimizations:
>
> $ env time -f '%E %M' node none.js >/dev/null
> 0:00.50 232320
>
> It is 4x slower and uses 4x memory than the empty nodejs program:
>
> $ env time -f '%E %M' node  0:00.13 59264
>
> and is worse than clojure-jvm plus some tweaks for options:
>
> $ env time -f '%E %M' java -jamvm -XX:+TieredCompilation
> -Xbootclasspath/a:$HOME/.m2/repository/org/clojure/clojure/1.8.0/clojure-1.8.0.jar
> clojure.main - <<< '(println "hello clojure-jvm")' >/dev/null
> 0:00.50 175024
>
> And how could we deploy those things?
>
> $ du -shc none.js out
> 4.0Kmain.js
> 2.7Mout
> 2.8Mtotal
> $ find none.js out -type f | wc -l
> 26
>
> Without dead code removal, it will be even worse for non-trival programs.
>
>
> :optimizations :simple will solve the deployment problem and will reduce
> startup time and memory footprint. But it is still 2x slower and uses 3x
> memory than the empty nodejs program:
>
> $ env time -f '%E %M' node simple.js >/dev/null
> 0:00.30 174912
> $ du -sh simple.js
> 708Ksimple.js
>
> And there are some bugs(timeout in core.async, in particular) under simple
> optimizations. Again, there is no dead code removal in simple
> optimizations. The Library Problem[3] still exists in clojurescript +
> nodejs.
>
>
> Under advanced optimizations, it will use 1.2x time and memory:
>
> $ env time -f '%E %M' node advanced.js >/dev/null
> 0:00.16 73552
> $ du -sh advanced.js
> 84K advanced.js
>
> With the help of dead code removal, we paid for what we actually use.
>
>
> The hello world program and the build options are the same as in the wiki
> page[1]:
>
> (ns hello-world.core
>   (:require [cljs.nodejs :as nodejs]))
> (nodejs/enable-util-print!)
> (defn -main [& args]
>   (println "Hello world!"))
> (set! *main-cli-fn* -main)
>
> (cljs.build.api/build "src"
>   {:main 'hello-world.core
>:output-to "none.js"
>:target :nodejs})
>
> simple.js and advanced.js are built using the following options:
>
> (cljs.build.api/build "src"
>   {:main 'hello-world.core
>:output-to "simple.js"
>:optimizations :simple
>:target :nodejs})
>
> (cljs.build.api/build "src"
>   {:main 'hello-world.core
>:output-to "advanced.js"
>:optimizations :advanced
>:optimize-constants true
>:static-fns true
>:target :nodejs})
>
> version of nodejs and java are 0.12 and 1.7 respectively:
>
> $ node -v
> v0.12.9
>
> $ java -version
> java version "1.7.0_55"
> OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1~0.12.04.2)
> OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
>
>
> [1]:
> https://github.com/clojure/clojurescript/wiki/Quick-Start/7f2360af24953303b282771870085620a83f0711#user-content-running-clojurescript-on-nodejs
>
> [2]:
> https://web.archive.org/web/20150716040442/http://funcool.github.io/clojurescript-unraveled#none
>
> [3]:
> https://github.com/clojure/clojurescript/wiki/Rationale#user-content-the-library-problem
>
> --
> Note that posts from new members are moderated - please be patient with
> your first post.
> ---
> You received this message because you are subscribed to the Google Groups
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojurescript+unsubscr...@googlegroups.com.
> To post to this group, send email to clojurescript@googlegroups.com.
> Visit this group at https://groups.google.com/group/clojurescript.
>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.


Re: [ClojureScript] Will advanced optimizations be officially supported on nodejs?

2016-01-25 Thread Andrey Antukh
Co-Author of ClojureScript Unreveled book here.

It seems tha that statement is deprecated now, I can remember some issues
in the past for some optimizations modes but now I think it works pretty
well in all optimization modes.

Myself I'm using advanced compilation mode with node in many of my projects
without issues.

PS: I will fix it in the book asap.

On Mon, Jan 25, 2016 at 10:48 AM, Moe Aboulkheir  wrote:

> I don't know what the official position is, but I use :advanced on nodejs
> a bunch.
>
> Take care,
> Moe
>
> On Mon, Jan 25, 2016 at 4:36 AM, Roc King  wrote:
>
>> Hi all!
>>
>> It seems unclear from the quick start wiki page[1]. But in Clojurescript
>> Unraveled[2], it says that :optimizations :none is *mandatory* for nodejs.
>>
>> Can we relay on advanced optimizations when targeting nodejs(currently or
>> in the future)?
>>
>> Thanks in advance.
>>
>>
>> Some reasons(other than runtime performance) to use advanced
>> optimizations:
>>
>> . fast startup time and small memory footprint
>> . easy to deployment
>> . hard to reverse engineering
>>
>> without them, clojurescript + nodejs are not so attractive than clojure +
>> jvm.
>>
>>
>> The hello world program from the quick start wiki page will take half a
>> second without optimizations:
>>
>> $ env time -f '%E %M' node none.js >/dev/null
>> 0:00.50 232320
>>
>> It is 4x slower and uses 4x memory than the empty nodejs program:
>>
>> $ env time -f '%E %M' node > 0:00.13 59264
>>
>> and is worse than clojure-jvm plus some tweaks for options:
>>
>> $ env time -f '%E %M' java -jamvm -XX:+TieredCompilation
>> -Xbootclasspath/a:$HOME/.m2/repository/org/clojure/clojure/1.8.0/clojure-1.8.0.jar
>> clojure.main - <<< '(println "hello clojure-jvm")' >/dev/null
>> 0:00.50 175024
>>
>> And how could we deploy those things?
>>
>> $ du -shc none.js out
>> 4.0Kmain.js
>> 2.7Mout
>> 2.8Mtotal
>> $ find none.js out -type f | wc -l
>> 26
>>
>> Without dead code removal, it will be even worse for non-trival programs.
>>
>>
>> :optimizations :simple will solve the deployment problem and will reduce
>> startup time and memory footprint. But it is still 2x slower and uses 3x
>> memory than the empty nodejs program:
>>
>> $ env time -f '%E %M' node simple.js >/dev/null
>> 0:00.30 174912
>> $ du -sh simple.js
>> 708Ksimple.js
>>
>> And there are some bugs(timeout in core.async, in particular) under
>> simple optimizations. Again, there is no dead code removal in simple
>> optimizations. The Library Problem[3] still exists in clojurescript +
>> nodejs.
>>
>>
>> Under advanced optimizations, it will use 1.2x time and memory:
>>
>> $ env time -f '%E %M' node advanced.js >/dev/null
>> 0:00.16 73552
>> $ du -sh advanced.js
>> 84K advanced.js
>>
>> With the help of dead code removal, we paid for what we actually use.
>>
>>
>> The hello world program and the build options are the same as in the wiki
>> page[1]:
>>
>> (ns hello-world.core
>>   (:require [cljs.nodejs :as nodejs]))
>> (nodejs/enable-util-print!)
>> (defn -main [& args]
>>   (println "Hello world!"))
>> (set! *main-cli-fn* -main)
>>
>> (cljs.build.api/build "src"
>>   {:main 'hello-world.core
>>:output-to "none.js"
>>:target :nodejs})
>>
>> simple.js and advanced.js are built using the following options:
>>
>> (cljs.build.api/build "src"
>>   {:main 'hello-world.core
>>:output-to "simple.js"
>>:optimizations :simple
>>:target :nodejs})
>>
>> (cljs.build.api/build "src"
>>   {:main 'hello-world.core
>>:output-to "advanced.js"
>>:optimizations :advanced
>>:optimize-constants true
>>:static-fns true
>>:target :nodejs})
>>
>> version of nodejs and java are 0.12 and 1.7 respectively:
>>
>> $ node -v
>> v0.12.9
>>
>> $ java -version
>> java version "1.7.0_55"
>> OpenJDK Runtime Environment (IcedTea 2.4.7)
>> (7u55-2.4.7-1ubuntu1~0.12.04.2)
>> OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
>>
>>
>> [1]:
>> https://github.com/clojure/clojurescript/wiki/Quick-Start/7f2360af24953303b282771870085620a83f0711#user-content-running-clojurescript-on-nodejs
>>
>> [2]:
>> https://web.archive.org/web/20150716040442/http://funcool.github.io/clojurescript-unraveled#none
>>
>> [3]:
>> https://github.com/clojure/clojurescript/wiki/Rationale#user-content-the-library-problem
>>
>> --
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "ClojureScript" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojurescript+unsubscr...@googlegroups.com.
>> To post to this group, send email to clojurescript@googlegroups.com.
>> Visit this group at https://groups.google.com/group/clojurescript.
>>
>
> --
> Note that posts from new members are moderated - please be patient with
> your first post.
> ---
> You received this message because you are subscribed to the 

[ClojureScript] Re: Will advanced optimizations be officially supported on nodejs?

2016-01-25 Thread Thomas Heller
Technically there is nothing holding you back from using :advanced on node, IF 
you supply all externs that is. And this is where the problem lies, you cannot 
easily provide externs since the closure compiler doesn't understand "require" 
properly.

CloSure assumes there is one global namespace that it controls fully and can 
rearrange as it likes. It is called whole program optimization after all. In 
node however each module has it's own little world it lives in and the use of 
global is discouraged. Most node modules usually are not part of the 
optimization either. The current strategy of require/UMD/ES6 module support in 
closure involves rewriting them to look like closure modules, this still has 
the requirement that it requires all code. Someone would still need to write 
externs for all modules that ship with node though.


However, you can cut down the size of :simple by a bit if you also use the 
flags you have for your :advanced build. 

(cljs.build.api/build "src" 
  {:main 'hello-world.core 
   :output-to "simple.js" 
   :optimizations :simple 
   :optimize-constants true 
   :static-fns true
   :pretty-print false
   :target :nodejs})

static-fns and optimize-constants are implicit for :advanced btw, you only need 
to specify them for :simple.

Depending of what your hello-world.core looks like :advanced may have 
eliminated almost everything. Which means you are comparing Apples and Oranges 
since most real world programs wont eliminate this much.



TL;DR: No, it is unlikely :advanced will be officially supported. If you 
compare programs that do actual work the difference will be much smaller and 
startup time usually becomes much less of an issue (if you can even call it an 
issue really).

HTH,
/thomas


On Monday, January 25, 2016 at 6:11:44 AM UTC+1, Roc King wrote:
> Hi all!
> 
> It seems unclear from the quick start wiki page[1]. But in Clojurescript 
> Unraveled[2], it says that :optimizations :none is *mandatory* for nodejs.
> 
> Can we relay on advanced optimizations when targeting nodejs(currently or in 
> the future)?
> 
> Thanks in advance.
> 
> 
> Some reasons(other than runtime performance) to use advanced optimizations:
> 
> . fast startup time and small memory footprint
> . easy to deployment
> . hard to reverse engineering
> 
> without them, clojurescript + nodejs are not so attractive than clojure + jvm.
> 
> 
> The hello world program from the quick start wiki page will take half a 
> second without optimizations:
> 
> $ env time -f '%E %M' node none.js >/dev/null
> 0:00.50 232320
> 
> It is 4x slower and uses 4x memory than the empty nodejs program:
> 
> $ env time -f '%E %M' node  0:00.13 59264
> 
> and is worse than clojure-jvm plus some tweaks for options:
> 
> $ env time -f '%E %M' java -jamvm -XX:+TieredCompilation 
> -Xbootclasspath/a:$HOME/.m2/repository/org/clojure/clojure/1.8.0/clojure-1.8.0.jar
>  clojure.main - <<< '(println "hello clojure-jvm")' >/dev/null
> 0:00.50 175024
> 
> And how could we deploy those things?
> 
> $ du -shc none.js out
> 4.0K  main.js
> 2.7M  out
> 2.8M  total
> $ find none.js out -type f | wc -l
> 26
> 
> Without dead code removal, it will be even worse for non-trival programs.
> 
> 
> :optimizations :simple will solve the deployment problem and will reduce 
> startup time and memory footprint. But it is still 2x slower and uses 3x 
> memory than the empty nodejs program:
> 
> $ env time -f '%E %M' node simple.js >/dev/null
> 0:00.30 174912
> $ du -sh simple.js 
> 708K  simple.js
> 
> And there are some bugs(timeout in core.async, in particular) under simple 
> optimizations. Again, there is no dead code removal in simple optimizations. 
> The Library Problem[3] still exists in clojurescript + nodejs.
> 
> 
> Under advanced optimizations, it will use 1.2x time and memory:
> 
> $ env time -f '%E %M' node advanced.js >/dev/null
> 0:00.16 73552
> $ du -sh advanced.js
> 84K   advanced.js
> 
> With the help of dead code removal, we paid for what we actually use.
> 
> 
> The hello world program and the build options are the same as in the wiki 
> page[1]:
> 
> (ns hello-world.core
>   (:require [cljs.nodejs :as nodejs]))
> (nodejs/enable-util-print!)
> (defn -main [& args]
>   (println "Hello world!"))
> (set! *main-cli-fn* -main)
> 
> (cljs.build.api/build "src"
>   {:main 'hello-world.core
>:output-to "none.js"
>:target :nodejs})
> 
> simple.js and advanced.js are built using the following options:
> 
> (cljs.build.api/build "src"
>   {:main 'hello-world.core
>:output-to "simple.js"
>:optimizations :simple
>:target :nodejs})
> 
> (cljs.build.api/build "src"
>   {:main 'hello-world.core
>:output-to "advanced.js"
>:optimizations :advanced
>:optimize-constants true
>:static-fns true
>:target :nodejs})
> 
> version of nodejs and java are 0.12 and 1.7 respectively:
> 
> $ node -v
> v0.12.9
> 
> $ java -version
> java version "1.7.0_55"
> OpenJDK Runtime Environment (IcedTea 2.4.7) 

Re: [ClojureScript] Re: Will advanced optimizations be officially supported on nodejs?

2016-01-25 Thread Moe Aboulkheir
On Mon, Jan 25, 2016 at 10:04 AM, Thomas Heller  wrote:

> Technically there is nothing holding you back from using :advanced on
> node, IF you supply all externs that is. And this is where the problem
> lies, you cannot easily provide externs since the closure compiler doesn't
> understand "require" properly.


It's not a fantastic or delicate solution, but depending on this project:
https://github.com/nervous-systems/cljs-nodejs-externs will pull in externs
for Node's built-in modules.

Take care,
Moe

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.