Coder Social home page Coder Social logo

Drop HTTP_URL_KEY? about httpebble-watch HOT 2 OPEN

katharine avatar katharine commented on August 24, 2024
Drop HTTP_URL_KEY?

from httpebble-watch.

Comments (2)

natevw avatar natevw commented on August 24, 2024

Here's some general notes about Pebble/dict/httpebble overhead and optimization. Looks like if a single key is used, there's room for 59 bytes data: http://forums.getpebble.com/discussion/comment/55097/#Comment_55097

That's not bad, but I'd love to squeeze more out as I'm transmitting images and this only allows 3 (of 168!) rows to be transmitted per request. Aleksandyr has some great observations in that post. What if httpebble took in a dictionary+caveats, but then serialized it to {uint16_t key, unsigned type:2, unsigned size:6, uint8_t data[]}? That'd be 3 bytes overhead per Tuple instead of 7, with the main limitation being a somewhat unfortunate 64-byte data limit (and a narrower keyspace, but seemingly more than sufficient).

from httpebble-watch.

natevw avatar natevw commented on August 24, 2024

Actually, you could get 128 bytes data which is then greater than the total input buffer! Basically, use only 1 bit for (primary) type. If set, it's a byte array with next 7 bits length. If unset, the remaining bits are an enum between cstring/int16/int32/int8/uint16/uint32/uint8 β€”Β for cstring you can either do Pascal-style length first or scan for the \0.

A little more work to enumerate, but since this would be converted to a Dictionary on the one end and JSON on the other anyway, probably not a big deal. Additionally you could drop the "master" tuple count to save a further byte. This would allow an even 80 bytes of binary response data (under a single key) or 84 if HTTP_URL_KEY is dropped; the only restriction would be all user keys need to be less than 0xFF00.

from httpebble-watch.

Related Issues (5)

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.