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?
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.
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
Nope, that is new to me -- I have successfully avoided JavaScript and mostly avoided ClojureScript for a long time now. thx for the pointer
V8, JavaScriptCore and SpiderMonkey are the most important ones - there is some warmup time but not as slow as JVM in my experience
for microbenchmarks I'm pretty sure there's a few libs out there
I don't use anything except for simple timing + many iterations and the Chrome profiler
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?
ie. using identical?
on the underlying string
identical? is ===
which strings always are compared by value
”asdf” === “asdf”
is always guaranteed to be true by the JS spec
Does JS even have a standard operation that determines if two strings (or arbitrary objects) are the same object in memory?
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
numbers are also always compared by value
@andy.fingerhut not true
JS has various primitive values
for objects yes - identity
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?
a relatively new edition - but yes, ES6 Map
you don't have a standard JS map type that supports equality based lookup
I don’t see any concrete JS evidence that strings are identical always
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
like (keyword-identical? (symbol "a") (symbol (js/String "a")))
I tried these sorts of things - and on chrome at least it works
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
which, I do see that it is
it doesn't vary between runtimes
primitive strings are always ===
, numbers, boolean, etc.
if it varied how could anything be portable?
@mikerod if you're looking for evidence you can read the JS language specification which covers this
definitely recommend checking this if you want to know what the VM implementers are guaranteeing
@dnolen I now see that identical?
is ===
which isn’t “object identity” for strings
so I just wasn’t thinking of it right I think, I’m more familiar with jvm and was just assuming some things
looks like the spec is clear on ===
behavior and strings
yep
I have read the spec some before too - just didn’t know what I was looking for here. thanks for the reference/info