
Show HN: JavaScript Cache Size Measurement - awirth
https://www.fromwhenceitca.me/cache_size/cache_size.html
======
shakna
For those hitting errors, the code is on GitHub [0]

And here's my own results: [1]

EDIT: I've also mirrored the repo, and turned it into a site using GitLab CI:
[2]

[0]
[https://github.com/allanlw/cache_size](https://github.com/allanlw/cache_size)

[1] [http://i.imgur.com/LKIvyCt.png](http://i.imgur.com/LKIvyCt.png)

[2] [http://shakna-israel.gitlab.io/cache_size/cache_size.html](http://shakna-
israel.gitlab.io/cache_size/cache_size.html)

~~~
vignesh_m
Are there distinct lines at 32k, 256k, 4M because of different levels of
caches? I feel like 32k is the L1 cache and so on.

~~~
shakna
On a less powerful machine, I got 32k, 1M, and 8M.

Just where the caching is happening inside the JS engine would be interesting
but probably take me weeks to dig down. Any ideas?

------
foota
I get an error trying to visit the site on ssl on win 10 chrome: "This site
can’t provide a secure connection

fromwhenceitca.me sent an invalid response. Try running Windows Network
Diagnostics. ERR_SSL_PROTOCOL_ERROR"

Edit: not ssl works, so go to
[http://www.fromwhenceitca.me/cache_size/cache_size.html](http://www.fromwhenceitca.me/cache_size/cache_size.html)

~~~
awirth
Lets just say I had some infra problems... I think everything should be better
now?

~~~
foota
Looks good! You might consider leaving padding between rows so that the table
doesn't adjust when adding the red, it's a bit annoying as is.

------
feifan
Results on a 15" Touchbar MBP [0]

Curious about why there's a big jump from 4MB to 8MB — I know my L3 cache size
is 8M [1]

[0] [http://imgur.com/a/8QNKO](http://imgur.com/a/8QNKO) [1]
[http://www.apple.com/macbook-pro/specs/](http://www.apple.com/macbook-
pro/specs/)

~~~
mbell
I have the same effect on my machine. My guess is that since the L3 cache is
shared between cores space used by processes running on other cores is causing
a bit of 'blurring' of the performance on the boundary based on how much will
data will fit.

~~~
awirth
I think it's this too. The L3 cache seems to be consistently harder to measure
than the L1 or L2 caches. I suspect it's just noise from other cores, but I
have no strong evidence to support that.

------
robertelder
$nslookup www.fromwhenceitca.me Server: 192.168.0.1 Address: 192.168.0.1#53

 __server can 't find www.fromwhenceitca.me: SERVFAIL

$ dig www.fromwhenceitca.me

; <<>> DiG 9.10.3-P4-Ubuntu <<>> www.fromwhenceitca.me ;; global options: +cmd
;; Got answer: ;; ->>HEADER<<\- opcode: QUERY, status: SERVFAIL, id: 23762 ;;
flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 512 ;; QUESTION
SECTION: ;www.fromwhenceitca.me. IN A

;; Query time: 209 msec ;; SERVER: 192.168.0.1#53(192.168.0.1) ;; WHEN: Sat
Dec 10 20:37:22 EST 2016 ;; MSG SIZE rcvd: 50

From Waterloo Canada

~~~
shakna
I'd try flushing your DNS, as the whois host points to a IP in Cloudflare's
range.

------
lgeek
I can see some pretty strong effects (and false positives) from what seem to
be TLB misses. On my system, on Firefox, the L2 size is not detected correctly
if transparent huge pages are enabled, but on Chromium it is. I'd like to take
a closer at what's going on, but the tooling for performance-related debugging
in browsers seem to be more or less missing. I've opened a pull request for
some fixes to the C implementation though.

~~~
awirth
Thanks for the PR!

It's certainly possible that there are some TLB issues with transparent huge
pages that mess up the results. I've had a terrible time debugging the
performance across different machines, browsers and OSes, and there seem to be
an uncountable number of things that can go wrong, especially with the JITs in
play. I'll try to track this one down later today, but I can't make any
promises.

