UnitPad

Write a sheet

  • traffic = 10 million request define a variable. let is optional.
  • latency = 20 ms write one definition on each line
  • qps = traffic / 1 day divide to make a rate
  • qps -> request/s convert to the units you choose. to also works.
  • 3 message per request per divides. The unit after per is the denominator.
  • unit car declare a unit
  • @aliases(trucks) unit truck add an alias. The plural trucks then works too.
  • # note start a comment. The engine ignores the rest of the line.

Import a module

  • use capacity import a module. Then use its capacity_* values and functions.
  • use throughput::service write :: to reach a module inside another
  • Select Import module to browse the modules, or Load example to start from an example sheet.
  • The modules cover latency (hardware, LLM, network, service), throughput (AWS, DB, S3, service, storage), size, count, capacity, availability, and cost.
  • The numbers in the modules are open source. To fix or add one, open the repository UnitPad/modules on GitHub.

Units

  • The standard library has time units (s min h day week month year) and data units (bit byte kB MB GB TB KiB MiB GiB).
  • It also has SI and imperial units, %, and prefixes such as ms and µs. See the full list of units in the Numbat docs.
  • kB is 1000 bytes. KiB is 1024 bytes. The year unit is a mean tropical year, about 365.2422 days.
  • Count units are separate dimensions: request, operation, message, record, event, row. They do not mix. Convert with a ratio, for example records_per_message = 10 record/message. Rates are <unit>/s.
  • Write USD, EUR, and others to convert currencies. The app refreshes the exchange rates each day.
  • A name cannot repeat a unit name or a built-in name. h, s, m, day, and the count units are taken.

Date and time

  • now() the current date and time. today() is today at midnight
  • datetime("2024-11-01 12:30:00") parse a date and time
  • now() - 1 million seconds subtract a duration. Use + to add one
  • calendar_add(now(), 40 day) add calendar time. day is exactly 24 hours and month is year / 12, so use this for calendar months or daylight saving time. calendar_sub subtracts
  • now() -> tz("America/New_York") convert to a time zone. -> local uses your local zone
  • You cannot compare two dates with <, >, or ==. Subtract them first, then compare the duration: (now() - deadline) > 0 s.

Functions and checks

  • ceil floor round sqrt abs min max ln log2 log10
  • round_in(GB, x) round to a whole number of GB
  • Mixed kinds of units cause an error. For example, request/s and GB do not mix.
  • Select a result's number or unit to copy the value. Select Copy sheet with results to copy the whole sheet, with the results as comments.

Editor

  • Type a name to open the autocomplete list, then pick an item.
  • Point at a name to see its documentation and its value.
  • Hold ⌘ (Ctrl on Windows and Linux) over a name, then select it, to go to where it is defined. For a name from a module, or from Numbat itself, this opens its source on GitHub.
  • Type ( to see a function's parameters.
  • For Unicode input, type \alpha, then press Tab, to get α.
  • now() and today() update each second. Other results update when you edit the sheet.
  • The line with the caret and its result are highlighted. Turn Current line highlight on or off in Settings.
  • Change the font size in Settings, under Font size or with the shortcuts. The lines scale with it.
  • Select a result to copy its value and move the caret to the end of its line.
  • Turn Comments in results on or off in Settings.

Shortcuts

  • ⌘SCtrlS Save
  • ⌘CCtrlC Copy line result (with nothing selected)
  • ⇧⌘]CtrlShift] Show next sheet
  • ⇧⌘[CtrlShift[ Show previous sheet
  • Tab/EnterTab/Enter Accept completion
  • TabTab Expand Unicode input
  • ⌘ZCtrlZ Undo
  • ⇧⌘Z/⌘YCtrlShiftZ/CtrlY Redo
  • ⌘ACtrlA Select all
  • EscEsc Close reference
  • ⌘=Ctrl= Zoom in
  • ⌘-Ctrl- Zoom out
  • ⌘0Ctrl0 Reset zoom
  • ⌘/Ctrl/ Open command palette

Your sheet stays on this device

  • It is calculated in your browser and saved on this device. It is never sent anywhere. The only request the page makes is for exchange rates, and it carries nothing of yours.
  • To keep a copy, search the command palette for Download sheet. The text file has the results or not, as you choose. With several sheets open, Download all sheets saves the open ones in one zip.
  • To open a file, select Open sheet from file, or drop the file on the page.