Fork me on GitHub
#cljs-dev
<
2019-08-15
>
andy.fingerhut01:08:37

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?

andy.fingerhut01:08:59

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.

lread18:08:52

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

andy.fingerhut18:08:41

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

dnolen03:08:05

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

dnolen03:08:43

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

dnolen03:08:38

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

mikerod16:08:26

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?

mikerod16:08:55

ie. using identical? on the underlying string

lilactown18:08:37

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

lilactown18:08:23

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

andy.fingerhut19:08:29

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

andy.fingerhut19:08:03

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

lilactown19:08:14

numbers are also always compared by value

dnolen19:08:58

JS has various primitive values

dnolen19:08:12

for objects yes - identity

andy.fingerhut19:08:49

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?

dnolen19:08:59

a relatively new edition - but yes, ES6 Map

dnolen19:08:19

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

mikerod19:08:10

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

mikerod19:08:33

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

mikerod19:08:53

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

mikerod19:08:03

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

mikerod19:08:32

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

mikerod19:08:06

which, I do see that it is

dnolen19:08:37

it doesn't vary between runtimes

dnolen19:08:59

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

dnolen19:08:08

if it varied how could anything be portable?

dnolen19:08:52

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

dnolen19:08:46

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

mikerod20:08:42

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

mikerod20:08:03

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

mikerod20:08:10

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

mikerod20:08:31

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