ec changed the topic of #elliottcable to: a π―ππ ππ π―πππππππππ π―ππππππ slash sΝΜuΝΝpΝΝeΜΜΊrΜΌΜ¦iΜΌΜoΜΜ¬rΜΜ cΜΝα»₯Μ§ΝαΈ·Μ‘ΝΕ£ΝΜ || #ELLIOTTCABLE is not about ELLIOTTCABLE
Sgeo has joined #elliottcable
Sgeo_ has quit [Ping timeout: 240 seconds]
Sgeo_ has joined #elliottcable
muelleme has joined #elliottcable
Sgeo has quit [Ping timeout: 248 seconds]
muelleme has quit [Ping timeout: 248 seconds]
muelleme has joined #elliottcable
muelleme has quit [Ping timeout: 276 seconds]
meowrobot has quit [Ping timeout: 248 seconds]
meowrobot has joined #elliottcable
muelleme has joined #elliottcable
muelleme has quit [Ping timeout: 260 seconds]
mylesborins has quit [Quit: farewell for now]
mylesborins has joined #elliottcable
muelleme has joined #elliottcable
muelleme has quit [Client Quit]
prophile has joined #elliottcable
<joepie91>
I wonder if it's possible to safely partially parallelize JS that isn't designed to run in parallel
<joepie91>
since there's nothing in that scope that can modify `number`
<joepie91>
therefore, no data races
<joepie91>
cc jfhbrook
<joepie91>
(talking on a runtime level here, not a userland code level)
<ljharb>
joepie91: you can't do that because `Array.prototype.map` could be modified.
<ljharb>
joepie91: basically you could only do *maybe* that when your function is 100% syntactic
<joepie91>
ljharb: this is assuming 'perfect runtime knowledge', ie. the optimization knows whether Array.prototype.map has been modified or not (and possibly even whether the modification breaks the guarantees or not)
<joepie91>
of course it is not *universally* possible
<ljharb>
joepie91: well yeah with that assumption you can parallelize like everything :-p
<joepie91>
but that is also true for userland code
<joepie91>
ljharb: so then the question is, why are runtimes (apparently) not doing that? :P
<ljharb>
they very well might be
<joepie91>
I've looked around a bit, and I can't find anything about it, and my empirical observations of CPU use also suggest that they're not
<ljharb>
i think, though, you're underestimating both the number of hazards (ie, times they'd have to bail out of the optimization), as well as overestimating how much "runtime knowledge" they can have
<joepie91>
if you know more than that, I'd be very happy to hear it :P
<joepie91>
(and I mean that non-sarcastically)
<ljharb>
i definitely don't know for sure
<ljharb>
but i suspect pretty strongly that the benefits would not outweigh the costs
<joepie91>
and well, I know that there's a good number of hazards, and a probably even greater number of "things that are not necessarily a hazard but a lot of work to analyze"
<joepie91>
perhaps, but I haven't found evidence of anybody actually trying this
<joepie91>
or even seriously researching it
<joepie91>
(for JS)
<joepie91>
ljharb: I wonder if it may actually be untested for the same reason that a lot of other parallelization things were untested before Firefox Quantum
<joepie91>
too hard to avoid data races
<joepie91>
(which is solvable with data ownership rules, at least in theory, like Rust implements)
<ljharb>
i'm not sure why firefox quantum changes anything
fujisan_ has joined #elliottcable
<jfhbrook>
quantum sounds good
<jfhbrook>
like it might be lightweight and futuristic
<jfhbrook>
like a 5 blade razor
<ljharb>
get that 5 blade shit outta here, my razor is 6 blades
<jfhbrook>
wrt parallelizations, scala appears to automatically parallelize code that operates in an entirely immutable manner
<jfhbrook>
I know this cause I've accidentally pegged all my cores on my macbook when writing inefficient algorithms
<joepie91>
ljharb: there's some more detailed posts on the mozilla hacks(?) blog, but the tl;dr is that parts of the Firefox codebase are now written in Rust precisely *because* it allows to write computationally concurrent code safely, and that has led to various optimizations (that both old Firefox and current Chrome are missing) that would have been impractical to implement without Rust's data race guarantees because it'd be too easy to introduce bugs
<joepie91>
along the way
<ljharb>
interesting
<joepie91>
ljharb: Quantum is just the 'codename' for the first Firefox version, 57, that ships some of these components :)