Live data from Hacker News

A Million Digits of Pi in 9 Lines of JavaScript

ajennings.net

51–60 of 86 posts

Re: A Million Digits of Pi in 9 Lines of JavaScript

#51

His demo page, in my Chrome, if I enter 10000, it takes about 2 seconds to finish with 10k digits. But if I enter 100k, it takes 30 seconds to get to reporting 10k digits worth of progress. Hmm. Have to think about that one. Just cause it's asking JS to do comparisons of much larger numbers?

I'd bet a good portion of the difference is between rendering the additional digits as it goes.

I didn't note timing numbers, but rendering digits in hex was basically instantaneous, even when doing a million (decimal) digits.

Rendering the digits in decimal was significant delay (like 40 seconds for a million digits). That's why it just shows the hex until the very end, and it shows how long the decimal conversion takes.

Re: A Million Digits of Pi in 9 Lines of JavaScript

#52

Earlier quoted context omitted.

Safari seems to be consistently behind these days, not sure why.

Apple seems to be the only browser developer that makes user-centric changes first, not developer-centric. I'm OK with that.

Given the recent influx of iOS exploits that have centered around WebKit they should probably adjust that priority

Re: A Million Digits of Pi in 9 Lines of JavaScript

#55

Earlier quoted context omitted.

Apple seems to be the only browser developer that makes user-centric changes first, not developer-centric. I'm OK with that.

Given the recent influx of iOS exploits that have centered around WebKit they should probably adjust that priority

Will adding developer-centric features help reduce vulnerabilities? Generally adding any feature would increase vulnerabilities because of the increased surface area.

Re: A Million Digits of Pi in 9 Lines of JavaScript

#56
post #5
post #3

Wow, I wonder why Firefox is so much slower? Quantum seems pretty zippy overall, but maybe that's largely due to fast rendering speeds? Does anyone on the Spidermonkey team have some insight?

Looks like they are using big integers, which I'd guess isn't something that comes up a lot, so probably hasn't been optimized for too much.

It is pretty new, and as you mention not many websites use them yet, so I'm sure there are more important optimizations the Firefox team is focusing on for now.

Re: A Million Digits of Pi in 9 Lines of JavaScript

#58
I was going to make a joke about just writing Math.PI.toFixed(10 * * 6), but it turns out that Number.toFixed() only supports up to 100 places AND Math.PI stops at the 50th place. Still amusing to me. Also, BigInt numbers can't be combined with non BigInt without conversion. I haven't had cause to use them yet, so I didn't know that.

Learned three new things making a dumb HN joke... not bad!

Re: A Million Digits of Pi in 9 Lines of JavaScript

#59

Earlier quoted context omitted.

Safari seems to be consistently behind these days, not sure why.

Apple seems to be the only browser developer that makes user-centric changes first, not developer-centric. I'm OK with that.

It seems user-centric to you know... make the browser work for what users what to use it for. Like generating digits of pi.
Post reply on HN