How do we start?

what do you all think is slow?


















The Best Way To Start

Measure!!

  • but there are more than one way to measure

















Before we measure via chrome

WARNING: Don't forget ulimit
If you get the issue:

failed to connect to server: Io(Os { code: 24, kind: Uncategorized, message: “Too many open files” })

Set a ulimit:

ulimit -u some_big_number
ulimit -n some_big_number # on Mac

lets take a look at the perf viz i have built specifically for this program and talk through it



lets launch 3 terminal applications



The Server

cd shooter
tsc && node dist/src/server.js --logPath /tmp/testing


The Client

cd shooter
cargo run --release -- -q 500 -g 100000 -t 2


The Viz Server

cd shooter
go run cmd/main.go

Then open a browser to localhost:42068 and put into the text box the file path you provided for the logging, which should be /tmp/testing
















A little searching is in order.

Lets do a small step ladder approach

  • run at 500 concurrent games
  • run at 1000 concurrent games
  • run at 2000 concurrent games


please save the log files

--logFile /tmp/master-500
--logFile /tmp/master-1000
--logFile /tmp/master-1500

we will want to refer to these later



We are doing a very crude "step ladder" test to see how our ratio grows with more games
















Chrome debugger

Ok now that we have a good understanding of our performance, lets try to make this program faster. The simplest way to do this is "Hot spot" optimizing



Chrome Devices: chrome://inspect/#devices



Now be careful, this type of optimization has its draw backs

  • quick netflix story with Yunong



Launch the program, but with --inspect

terminal 1

cd shooter
tsc && node --inspect dist/src/server.js --logPath /tmp/testing

terminal 2

cd shooter
cargo run --release -- -q 1000 -g 100000 -t 2

TO CHROME!!!

Performance Tab

If you don't have the performance tab, please download the latest version of chrome to get it
















Lets Profile Performance

I only profiled a short period of time due to the tool. if you go to long i have hit some weird issues with chrome
















Lets look at the code, what is wrong?

This may come as a shock....