cljs-dev

ClojureScript compiler & std lib dev, https://clojurescript.org/community/dev
2019-08-15T01:13:37.097200Z

I know a fair amount about perf testing on Clojure on Java, but not so much about what good recommendations might be for ClojureScript. Are there 1 to maybe up to 3 JS runtimes that are most important for perf testing? Anything like JVM JIT warm-up time to be concerned about, and if so, any recommended libraries to help do that for you?

2019-08-15T01:14:59.098100Z

I'm asking because of the core.rrb-vector library, which is focused on in-memory vector data structures only, so things like DOM access or GUI interactions should be a non-issue.

lread 2019-08-15T18:22:52.102800Z

hi @andy.fingerhut, I expect you know about simple-benchmark, but just in case, here’s an mfikes blog article on it: https://blog.fikesfarm.com/posts/2017-11-18-clojurescript-performance-measurement.html

2019-08-15T18:23:41.103Z

Nope, that is new to me -- I have successfully avoided JavaScript and mostly avoided ClojureScript for a long time now. thx for the pointer

dnolen 2019-08-15T03:15:05.099Z

V8, JavaScriptCore and SpiderMonkey are the most important ones - there is some warmup time but not as slow as JVM in my experience

dnolen 2019-08-15T03:15:43.099800Z

for microbenchmarks I'm pretty sure there's a few libs out there

dnolen 2019-08-15T03:16:38.100700Z

I don't use anything except for simple timing + many iterations and the Chrome profiler

2019-08-15T16:37:26.102Z

I think I’ve tracked this answer down before, but now can’t figure it out 100% again. What is about JS strings that makes it safe to do keyword-identical? & symbol-identical? be done on the underlying string?

2019-08-15T16:39:55.102600Z

ie. using identical? on the underlying string

lilactown 2019-08-15T18:55:37.104200Z

identical? is === which strings always are compared by value

lilactown 2019-08-15T18:56:23.105100Z

”asdf” === “asdf” is always guaranteed to be true by the JS spec

2019-08-15T19:10:29.106500Z

Does JS even have a standard operation that determines if two strings (or arbitrary objects) are the same object in memory?

2019-08-15T19:13:03.107200Z

Maybe answering my own question, but looks like === is "same object" with perhaps the only exception being for strings: https://stackoverflow.com/questions/13685079/how-to-check-if-two-vars-have-the-same-reference

lilactown 2019-08-15T19:25:14.107600Z

numbers are also always compared by value

dnolen 2019-08-15T19:32:53.107900Z

@andy.fingerhut not true

dnolen 2019-08-15T19:32:58.108100Z

JS has various primitive values

dnolen 2019-08-15T19:33:12.108400Z

for objects yes - identity

2019-08-15T19:36:49.109300Z

Since this discussion reminded me of it, does JS have things like Java's IdentityHashMap, i.e. a hash keyed by object identity rather than some other notion of equality?

dnolen 2019-08-15T19:37:59.110Z

a relatively new edition - but yes, ES6 Map

dnolen 2019-08-15T19:38:19.110500Z

you don't have a standard JS map type that supports equality based lookup

2019-08-15T19:44:10.110900Z

I don’t see any concrete JS evidence that strings are identical always

2019-08-15T19:44:33.111400Z

but it seems to work out for the cases I’ve tried - but then again, it’ll possibly vary from runtime to runtime - so was wondering if it was a spec thing

2019-08-15T19:44:53.111900Z

like (keyword-identical? (symbol "a") (symbol (js/String "a")))

2019-08-15T19:45:03.112200Z

I tried these sorts of things - and on chrome at least it works

2019-08-15T19:45:32.112800Z

but was trying to find times when it doesn’t work, but if the identical? of cljs is === and that isn’t object-identity then perhaps that’s the answer

2019-08-15T19:47:06.113Z

which, I do see that it is

dnolen 2019-08-15T19:51:37.113400Z

it doesn't vary between runtimes

dnolen 2019-08-15T19:51:59.113800Z

primitive strings are always ===, numbers, boolean, etc.

dnolen 2019-08-15T19:52:08.114100Z

if it varied how could anything be portable?

dnolen 2019-08-15T19:53:52.114600Z

@mikerod if you're looking for evidence you can read the JS language specification which covers this

dnolen 2019-08-15T19:54:46.115500Z

definitely recommend checking this if you want to know what the VM implementers are guaranteeing

2019-08-15T20:05:42.115900Z

@dnolen I now see that identical? is === which isn’t “object identity” for strings

2019-08-15T20:06:03.116400Z

so I just wasn’t thinking of it right I think, I’m more familiar with jvm and was just assuming some things

2019-08-15T20:06:10.116700Z

looks like the spec is clear on === behavior and strings

dnolen 2019-08-15T20:06:17.117Z

yep

2019-08-15T20:06:31.117300Z

I have read the spec some before too - just didn’t know what I was looking for here. thanks for the reference/info