npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

snipe-benchmark

v1.0.0

Published

Standard benchmark for Minecraft name snipers/blockers.

Downloads

2

Readme

Snipe Benchmark

A standard benchmark for Minecraft name snipers/blockers.

Quick-Start

<API_BASE> is the base URL of the benchmark server. Currently you can use the public deployment at https://snipe-benchmark.herokuapp.com

<YOUR_ID> is a unique identifier used to identify your sniper. This can be anything, but "arceus-v1.0.0" or "ares-vIDFK" are good examples.

  1. Setup the benchmark for a given time. Timestamp should be in milliseconds since the UNIX epoch:

    POST /<YOUR_ID>

    {
        "time": <TIMESTAMP>
    }
  2. Copy your snipers code, changing the snipe request to GET <API_BASE>/<YOUR_ID>/snipe. The server will send back no response to minimize resource usage under heavy load, but it will log your request.

  3. Get your results from the server by requesting GET <API_BASE>/<YOUR_ID>. The server will send back a response like this:

{
  "time": <BENCHMARK_TIME>,
  "requests": <REQUEST_COUNT>,
  "result": {
    "delay": <SNIPE_DELAY>,
    "requests": {
      "start": <FIRST_REQUEST>,
      "early": <EARLY_REQUESTS>,
      "late": <LATE_REQUESTS>,
      "end": <LAST_REQUEST>,
      "rate": <REQUEST_RATE>
    }
  }
}

Example

Here's an example in Python:

import requests
from datetime import datetime, timedelta
import time

def benchmark():
    bench_time = datetime.now() + timedelta(seconds=20) # Benchmark in 20 seconds

    # Set up benchmark
    requests.post("https://snipe-benchmark.herokuapp.com/python-example-v1.0.0", json={
        "time": bench_time.timestamp() * 1000 # Get the timestamp and convert from seconds to milliseconds
    })

    # Wait for benchmark
    while datetime.now() < bench_time:
        time.sleep(0.1)

    # Send snipe request
    requests.get("https://snipe-benchmark.herokuapp.com/python-example-v1.0.0/snipe")

    # Get results object
    res = requests.get("https://snipe-benchmark.herokuapp.com/python-example-v1.0.0")

    print(res.json())

benchmark()

Running should return something like this:

{
  "time": 1597768684767.3691,
  "requests": 1,
  "result": {
    "delay": 374.630859375,
    "requests": {
      "start": 1597768685683.4823,
      "early": 0,
      "late": 1,
      "end": 1597768685683.4823,
      "rate": null // This would normally be the average requests / second, but we only sent one request
    }
  }
}

So we got a delay around 375 milliseconds, not too bad for 10 lines of Python (minified).

Contributing

Please feel free to fork and make a pull request. The code is quite simple and for now is contained in just one file, src/app.js.

Planned Features

  • [x] Quick-start guide
  • [x] More granular result data
  • [x] Request / second result
  • [ ] Deploy on AWS behind Cloudfront to better simulate the Mojang API
  • [ ] Sniper leaderboards + auth system to prevent sabotage