Skip to content

Shorten generated URL #243

@KvanTTT

Description

@KvanTTT

Currently, it's long even for a short "Hello world" program:

https://play.kotlinlang.org/#eyJ2ZXJzaW9uIjoiMi4yLjIwIiwicGxhdGZvcm0iOiJ3YXNtIiwiYXJncyI6IiIsIm5vbmVNYXJrZXJzIjp0cnVlLCJ0aGVtZSI6ImlkZWEiLCJjb2RlIjoiZnVuIG1haW4oKSB7XG4gICAgcHJpbnRsbihcIkhlbGxvXCIpXG59In0=

The URL stores the following (base64-encoded):

{"version":"2.2.20","platform":"wasm","args":"","noneMarkers":true,"theme":"idea","code":"fun main() {\n    println(\"Hello\")\n}"}

Since the URL is not human-readable anyway, I suggest considering the following optimizations for it:

  • Use an archiver (gzip?) for the input code before compressing to base64
  • Remove non-essential symbols from the input: leading and trailing braces ({}), double quotes for keys, probably pairs with empty values ("args":"")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions