cljs-dev

ClojureScript compiler & std lib dev, https://clojurescript.org/community/dev
dnolen 2020-03-26T16:53:51.079900Z

@gfredericks how much does test.check depend on goog.math.Long? I'm probably going to drop that dep since it's in fact covered by goog.math.Integer

alexmiller 2020-03-26T16:55:57.080200Z

I'm no expert, but from perusing the code, I'd say "a lot"

alexmiller 2020-03-26T16:58:09.080500Z

primarily in the random number generator

thheller 2020-03-26T17:12:27.081300Z

@dnolen didn't you add Long support to core when working on transit? I thought that motivated the addition? https://github.com/cognitect/transit-js/blob/f49c7bae88bfbb4b0c36966d8a987341e44a3359/src/com/cognitect/transit/types.js#L18

dnolen 2020-03-26T17:23:13.082200Z

@alexmiller it's marked as legacy by Closure now and you can accomplish the same thing with Integer

dnolen 2020-03-26T17:23:58.083100Z

it s also a massive pain because it's one of the few namespaces we use that needs AOT transformation - so it's really hampering REPL maintenance

dnolen 2020-03-26T17:24:58.083800Z

@thheller hrm that might be true, but I recall some back and forth with test.check

alexmiller 2020-03-26T17:25:12.084100Z

Gary is not actually working on test.check anymore so someone would need to step up to do that work

dnolen 2020-03-26T17:26:48.084600Z

anything else really?

alexmiller 2020-03-26T17:52:00.085100Z

the random stuff is based on that too and I know a lot of care was taken to have the outputs match in clj and cljs

alexmiller 2020-03-26T17:52:56.085500Z

Gary did a talk about it https://www.youtube.com/watch?v=u0t-6lUvXHo

dnolen 2020-03-26T18:00:22.086100Z

@alexmiller I guess what I mean is I don't see how goog.math.Long as an implementation detail for test.check here (over Integer) is meaningful

dnolen 2020-03-26T18:00:56.086800Z

ClojureScript doesn't support it as an arithmetic value

dnolen 2020-03-26T18:01:22.087100Z

nor Integer

dnolen 2020-03-26T18:03:02.087600Z

the only things that support it are the predicates and that was for test.check by way of spec.alpha

alexmiller 2020-03-26T18:04:10.088100Z

I don't know anything about several pieces of this so I am not trying to debate you about it :)

dnolen 2020-03-26T18:07:49.088500Z

ok 🙂

dnolen 2020-03-26T18:26:00.089100Z

@alexmiller I can probably handle the long changes - assessing this change first for REPLs

dnolen 2020-03-26T18:33:21.089700Z

(assuming we drop them, I'm taking the time to assess using Closure to compile the problem away - and we can punt that change down the road)

2020-03-26T21:43:40.090800Z

The Integer class can do 64 bit bit twiddling?

2020-03-26T21:44:47.092Z

Even if so, I'd wonder if performance would get worse

dnolen 2020-03-26T21:45:17.092600Z

shift right and left - it's really the same thing just an array of integers instead of two 32 bit integers

dnolen 2020-03-26T21:45:32.093300Z

I'm somewhat skeptical that it will make a big difference on performance

dnolen 2020-03-26T21:45:48.093800Z

given Long is deprecated and hard to use and Integer is not

dnolen 2020-03-26T21:45:55.094300Z

I think Google has decided the more meaningful lib

2020-03-26T21:46:06.094600Z

That's the only issue I can think of

dnolen 2020-03-26T21:46:43.095400Z

k, like I said, I'm trying to avoid dropping it

dnolen 2020-03-26T21:47:06.096500Z

if this works then we can make a more gradual todo to drop it

2020-03-26T21:47:11.096600Z

Like alex said, the current rng impl gives identical results cross platform. That's not a crucial feature though, I just thought it was cool.

2020-03-26T21:47:27.097300Z

That's only relevant if you consider changing the algorithm to recover perf somehow

dnolen 2020-03-26T21:47:34.097600Z

is that checked automatically during testing?

dnolen 2020-03-26T21:47:41.097900Z

or is it more manual?

2020-03-26T21:47:51.098300Z

Hmm, it might be, I'll check

dnolen 2020-03-26T21:47:55.098500Z

thanks!

2020-03-26T21:49:10.099100Z

The tests will fail if the cljs algorithm changes unilaterally

2020-03-26T21:49:54.099200Z

dnolen 2020-03-26T21:58:29.100100Z

ah k, cool

2020-03-26T21:59:23.101300Z

The weirdest part of the current code is that the multiplication algorithm was inlined so that some unnecessary checks could be removed

2020-03-26T22:00:16.101900Z

(I.e., pasted/translated from the goog lib)