Git Product home page Git Product logo

fastestwebsiteever's Introduction

Build Status

what is this?

the greatest website to ever fit in a single TCP packet

optimizations

  • HTTP compression: choose DEFLATE over GZIP because most browsers accept raw DEFLATE output without a header or checksum so it's shorter/faster. #yolo
  • send response immediately after TCP session init: avoids 1 round trip (not to spec, seems to confuse Chrome results in Wireshark).
  • SO_BUSY_POLL: asks the kernel to poll for packets for a given amount of time.
  • TCP_NODELAY: disable Nagle's algorithm.
  • echo 1 > /proc/sys/net/ipv4/tcp_low_latency: TCP stack makes decisions that prefer lower latency as opposed to higher throughput.
  • favicon: reduced gif to 1/2 original frame count, applied lossy LZW compression.
  • HTML mangling: closing tags are for losers.
  • bespoke webserver written in C
  • remove GIF comment extension block, saving 36 bytes (thanks Samy Kamkar)

who made this?

eV ([email protected]), yan ([email protected])

Get in touch today to hear about our 120-byte ad sponsorship opportunities!

credits

fastestwebsiteever's People

Contributors

diracdeltas avatar evq avatar fmarier avatar justinormont avatar p01 avatar samyk avatar sigttou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fastestwebsiteever's Issues

Safari

It doesn't seem to work under Safari 11 (macOS 10.13).

Buffer overflow, every time

I recognize that it wouldn't be C without a buffer overflow or two. That said:

    send_buffer = (char*)calloc(numbytes, sizeof(char));	
    hdrbytes = sprintf(send_buffer, "HTTP/1.1 200 k\nContent-Length: %d\ncontent-encoding: deflate\n\n", numbytes);
    memcpy(send_buffer+hdrbytes, buffer, numbytes);

send_buffer has size numbytes. You then copy numbytes worth of data onto a place starting after the beginning of send_buffer. Looks like a buffer overflow to me! Simplest fix is to have an intermediate buffer for the header, and only allocate send_buffer once we know how big it needs to be.

Save some bytes

hdrbytes = sprintf(send_buffer, "HTTP/1.1 200 OK\r\nContent-Length: %d\r\ncontent-encoding: deflate\r\n\r\n", numbytes);

  • Clients should accept just \n for line termination, so you can shave off 4 \rs
  • The reason-phrase isn't checked, so you should be able to get away with a single byte here, maybe even zero. Try O.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.