arctic-hen7 / perseus-size-opt

Adds size optimizations to any Perseus app automatically.
MIT License
10 stars 2 forks source link

Custom `SizeOpts` have no effect #3

Closed phaleth closed 3 years ago

phaleth commented 3 years ago

The SizeOpts::default() is always applied, no matter how is the SizeOpts struct provided. This leads to an issue with low memory on a VPS because lto cannot be set to false using this plugin.

Bellow is a standalone Dockerfile that causes the out of memory problem on a VPS during compilation at the perseus deploy and the log of the last two steps.

Dockerfile

# get the base image
FROM rust:1.55-slim AS build

# install build dependencies
RUN apt update \
  && apt install -y --no-install-recommends lsb-release apt-transport-https \
  build-essential curl

# prepare root project dir
WORKDIR /app

# download the target for wasm
RUN rustup target add wasm32-unknown-unknown

# install wasm-pack
RUN cargo install wasm-pack

# retrieve the src dir
RUN curl https://codeload.github.com/arctic-hen7/perseus-size-opt/tar.gz/main | tar -xz --strip=2 perseus-size-opt-main/examples/simple

# go to src dir
WORKDIR /app/simple

# install perseus-cli
RUN cargo install perseus-cli --version 0.3.0-beta.13

# clean app
RUN perseus clean

# adjust app config
RUN sed -i s'/perseus = .*/perseus = "0.3.0-beta.13"/' ./Cargo.toml \
  && sed -i s'/perseus-size-opt = .*/perseus-size-opt = "0.1.0"/' ./Cargo.toml \
  && cat ./Cargo.toml

# activate plugin(s)
RUN perseus tinker

# modify lib.rs
RUN sed -i s'/SizeOpts::default()/SizeOpts { wee_alloc: true, lto: false, opt_level: "s".to_string(), codegen_units: 1, }/' ./src/lib.rs \
  && sed -i s'/"Hello World!"/"世界您好 !"/' ./src/lib.rs \
  && cat ./src/lib.rs

# deploy app
RUN perseus deploy

# prepare deployment image
FROM bitnami/minideb:buster

WORKDIR /app

COPY --from=build /app/simple/pkg /app/

ENV PERSEUS_STANDALONE=true

ENV HOST=0.0.0.0

CMD ["./server"]

Docker image build

...
Step 12/19 : RUN sed -i s'/SizeOpts::default()/SizeOpts { wee_alloc: true, lto: false, opt_level: "s".to_string(), codegen_units: 1, }/' ./src/lib.rs   && sed -i s'/"Hello World!"/"世界您好 !"/' ./src/lib.rs   && cat ./src/lib.rs
 ---> Running in bdf281af51eb
use perseus::{define_app, plugins::Plugins, ErrorPages, Template};
use perseus_size_opt::{perseus_size_opt, SizeOpts};
use sycamore::template;

define_app! {
    templates: [
        Template::<G>::new("index").template(|_| {
            template! {
                p { "世界您好 !" }
            }
        })
    ],
    error_pages: ErrorPages::new(|url, status, err, _| {
        template! {
            p { (format!("An error with HTTP code {} occurred at '{}': '{}'.", status, url, err)) }
        }
    }),
    plugins: Plugins::new().plugin(perseus_size_opt(), SizeOpts { wee_alloc: true, lto: false, opt_level: "s".to_string(), codegen_units: 1, })
}
Removing intermediate container bdf281af51eb
 ---> 77c19c9e9eae
Step 13/19 : RUN perseus deploy
 ---> Running in 0a1d94e4c40f
    Updating crates.io index
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
 Downloading crates ...
  Downloaded actix-http v2.2.1
  Downloaded typenum v1.14.0
  Downloaded version_check v0.1.5
  Downloaded wee_alloc v0.4.5
  Downloaded actix-macros v0.1.3
  Downloaded actix-service v1.0.6
  Downloaded actix-utils v2.0.0
  Downloaded enum-as-inner v0.3.3
  Downloaded perseus-actix-web v0.3.0-beta.13
  Downloaded pin-project-lite v0.1.12
  Downloaded tracing-core v0.1.21
  Downloaded bytes v0.5.6
  Downloaded hostname v0.3.1
  Downloaded lru-cache v0.1.2
  Downloaded time v0.2.27
  Downloaded sha-1 v0.9.8
  Downloaded standback v0.2.17
  Downloaded serde_urlencoded v0.7.0
  Downloaded rand_chacha v0.2.2
  Downloaded cpufeatures v0.2.1
  Downloaded resolv-conf v0.7.0
  Downloaded tokio v0.2.25
  Downloaded rustc_version v0.3.3
  Downloaded semver-parser v0.10.2
  Downloaded const_fn v0.4.8
  Downloaded pest v2.1.3
  Downloaded language-tags v0.2.2
  Downloaded ppv-lite86 v0.2.14
  Downloaded cookie v0.14.4
  Downloaded actix-threadpool v0.3.3
  Downloaded digest v0.9.0
  Downloaded pin-project v1.0.8
  Downloaded pin-project v0.4.28
  Downloaded opaque-debug v0.3.0
  Downloaded getrandom v0.1.16
  Downloaded fxhash v0.2.1
  Downloaded copyless v0.1.5
  Downloaded convert_case v0.4.0
  Downloaded actix-codec v0.3.0
  Downloaded threadpool v1.8.1
  Downloaded signal-hook-registry v1.4.0
  Downloaded semver v0.11.0
  Downloaded nom v4.2.3
  Downloaded match_cfg v0.1.0
  Downloaded linked-hash-map v0.5.4
  Downloaded generic-array v0.14.4
  Downloaded actix-tls v2.0.0
  Downloaded block-buffer v0.9.0
  Downloaded base64 v0.13.0
  Downloaded tracing v0.1.29
  Downloaded tokio-util v0.3.1
  Downloaded pin-project-internal v0.4.28
  Downloaded pin-project-internal v1.0.8
  Downloaded mio-uds v0.6.8
  Downloaded memory_units v0.4.0
  Downloaded h2 v0.2.7
  Downloaded derive_more v0.99.16
  Downloaded bytestring v1.0.0
  Downloaded buf-min v0.4.0
  Downloaded brotli2 v0.3.2
  Downloaded awc v2.0.3
  Downloaded actix-web-codegen v0.4.0
  Downloaded actix-router v0.2.7
  Downloaded actix-testing v1.0.1
  Downloaded actix-rt v1.1.1
  Downloaded actix-server v1.0.4
  Downloaded actix-files v0.5.0
  Downloaded actix-connect v2.0.0
  Downloaded v_htmlescape v0.12.0
  Downloaded v_escape_derive v0.8.5
  Downloaded v_escape v0.15.0
  Downloaded brotli-sys v0.3.2
  Downloaded time-macros-impl v0.1.2
  Downloaded ucd-trie v0.1.3
  Downloaded time-macros v0.1.1
  Downloaded socket2 v0.3.19
  Downloaded rand_core v0.5.1
  Downloaded rand v0.7.3
  Downloaded trust-dns-resolver v0.19.7
  Downloaded trust-dns-proto v0.19.7
  Downloaded tracing-futures v0.2.5
  Downloaded actix-web v3.3.2
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on build directory
   Compiling libc v0.2.105
   Compiling futures-core v0.3.17
   Compiling futures-sink v0.3.17
   Compiling futures-channel v0.3.17
   Compiling bytes v0.5.6
   Compiling pin-project-lite v0.1.12
   Compiling pin-project-internal v0.4.28
   Compiling parking_lot_core v0.8.5
   Compiling scopeguard v1.1.0
   Compiling getrandom v0.1.16
   Compiling convert_case v0.4.0
   Compiling tinyvec_macros v0.1.0
   Compiling percent-encoding v2.1.0
   Compiling matches v0.1.9
   Compiling bitflags v1.3.2
   Compiling typenum v1.14.0
   Compiling copyless v0.1.5
   Compiling ppv-lite86 v0.2.14
   Compiling unicode-bidi v0.3.7
   Compiling unicode-segmentation v1.8.0
   Compiling either v1.6.1
   Compiling cc v1.0.71
   Compiling const_fn v0.4.8
   Compiling match_cfg v0.1.0
   Compiling quick-error v1.2.3
   Compiling version_check v0.1.5
   Compiling linked-hash-map v0.5.4
   Compiling crc32fast v1.2.1
   Compiling httparse v1.5.1
   Compiling encoding_rs v0.8.29
   Compiling adler v1.0.2
   Compiling regex-syntax v0.6.25
   Compiling mime v0.3.16
   Compiling cpufeatures v0.2.1
   Compiling byteorder v1.4.3
   Compiling opaque-debug v0.3.0
   Compiling language-tags v0.2.2
   Compiling base64 v0.13.0
   Compiling v_escape v0.15.0
   Compiling v_htmlescape v0.12.0
   Compiling standback v0.2.17
   Compiling generic-array v0.14.4
   Compiling unicase v2.6.0
   Compiling time v0.2.27
   Compiling cookie v0.14.4
   Compiling instant v0.1.12
   Compiling futures-util v0.3.17
   Compiling miniz_oxide v0.4.4
   Compiling log v0.4.14
   Compiling tracing-core v0.1.21
   Compiling buf-min v0.4.0
   Compiling bytestring v1.0.0
   Compiling lock_api v0.4.5
   Compiling tinyvec v1.5.0
   Compiling form_urlencoded v1.0.1
   Compiling heck v0.3.3
   Compiling nom v4.2.3
   Compiling lru-cache v0.1.2
   Compiling brotli-sys v0.3.2
   Compiling fxhash v0.2.1
   Compiling unicode-normalization v0.1.19
   Compiling aho-corasick v0.7.18
   Compiling tracing v0.1.29
   Compiling iovec v0.1.4
   Compiling net2 v0.2.37
   Compiling signal-hook-registry v1.4.0
   Compiling num_cpus v1.13.0
   Compiling getrandom v0.2.3
   Compiling hostname v0.3.1
   Compiling time v0.1.43
   Compiling socket2 v0.3.19
   Compiling wee_alloc v0.4.5
   Compiling idna v0.2.3
   Compiling mime_guess v2.0.3
   Compiling flate2 v1.0.22
   Compiling regex v1.5.4
   Compiling mio v0.6.23
   Compiling threadpool v1.8.1
   Compiling parking_lot v0.11.2
   Compiling rand_core v0.5.1
   Compiling ahash v0.7.6
   Compiling resolv-conf v0.7.0
   Compiling block-buffer v0.9.0
   Compiling digest v0.9.0
   Compiling url v2.2.2
   Compiling derive_more v0.99.16
   Compiling actix-macros v0.1.3
   Compiling time-macros-impl v0.1.2
   Compiling enum-as-inner v0.3.3
   Compiling pin-project-internal v1.0.8
   Compiling v_escape_derive v0.8.5
   Compiling actix-web-codegen v0.4.0
   Compiling chrono v0.4.19
   Compiling brotli2 v0.3.2
   Compiling mio-uds v0.6.8
   Compiling rand_chacha v0.2.2
   Compiling sha-1 v0.9.8
   Compiling pin-project v0.4.28
   Compiling time-macros v0.1.1
   Compiling actix-threadpool v0.3.3
   Compiling pin-project v1.0.8
   Compiling tokio v0.2.25
   Compiling rand v0.7.3
   Compiling serde_urlencoded v0.7.0
   Compiling actix-router v0.2.7
   Compiling tracing-futures v0.2.5
   Compiling futures-executor v0.3.17
   Compiling actix-service v1.0.6
   Compiling tokio-util v0.3.1
   Compiling actix-rt v1.1.1
   Compiling futures v0.3.17
   Compiling actix-codec v0.3.0
   Compiling h2 v0.2.7
   Compiling trust-dns-proto v0.19.7
   Compiling actix-utils v2.0.0
   Compiling trust-dns-resolver v0.19.7
   Compiling actix-server v1.0.4
   Compiling actix-tls v2.0.0
   Compiling sycamore-reactive v0.6.3
   Compiling actix-connect v2.0.0
   Compiling actix-testing v1.0.1
   Compiling sycamore v0.6.3
   Compiling actix-http v2.2.1
   Compiling sycamore-router v0.6.3
   Compiling awc v2.0.3
   Compiling perseus v0.3.0-beta.13
   Compiling actix-web v3.3.2
   Compiling perseus-size-opt v0.1.0
   Compiling perseus-size-opt-example-simple v0.1.0 (/app/simple)
   Compiling actix-files v0.5.0
   Compiling perseus-engine v0.3.0-beta.13 (/app/simple/.perseus)
   Compiling perseus-actix-web v0.3.0-beta.13
   Compiling perseus-cli-server v0.3.0-beta.13 (/app/simple/.perseus/server)
error: could not compile `perseus-cli-server`

Caused by:
  process didn't exit successfully: `rustc --crate-name perseus_cli_server --edition=2018 server/src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=z -C lto -C codegen-units=1 -C metadata=3b9ed88fdcb18d6e -C extra-filename=-3b9ed88fdcb18d6e --out-dir /app/simple/.perseus/target/release/deps -L dependency=/app/simple/.perseus/target/release/deps --extern actix_web=/app/simple/.perseus/target/release/deps/libactix_web-bdacbe803fc51059.rlib --extern futures=/app/simple/.perseus/target/release/deps/libfutures-5cb1929ee8e064fa.rlib --extern perseus=/app/simple/.perseus/target/release/deps/libperseus-e171b542cb7455e1.rlib --extern perseus_actix_web=/app/simple/.perseus/target/release/deps/libperseus_actix_web-832bd4e5c6f9f86a.rlib --extern perseus_engine=/app/simple/.perseus/target/release/deps/libperseus_engine.rlib --extern app=/app/simple/.perseus/target/release/deps/libperseus_size_opt_example_simple-b089b08de55c6498.rlib -L native=/app/simple/.perseus/target/release/build/brotli-sys-ac9a6fa216999f3a/out` (signal: 9, SIGKILL: kill)
ERROR: Service 'perseus' failed to build : The command '/bin/sh -c perseus deploy' returned a non-zero code: 1
arctic-hen7 commented 3 years ago

I don't think that's the issue behind this, because applying custom size optimizations does result in the correct ones being applied in .perseus/Cargo.toml (on my machine at least). It does look like you're running perseus tinker before configuring the plugin though. To clarify, perseus tinker doesn't activate plugins, it runs tinker-timer plugins (like this one). So you'll need to run it after you've altered lib.rs.

phaleth commented 3 years ago

Ok, great. I totally didn't get the clue that perseus tinker should indeed modify .perseus/Cargo.toml. Bellow is the fixed Dockerfile and the log from VPS.

Actually, now that I think of the whole process. It'd be nice if perseus prep would always had to be called before perseus tinker or rather that the .perseus/ dir is somehow created first before perseus tinker call, otherwise perseus tinker could throw an error saying that the .perseus/ dir is missing, but that decision is up to you @arctic-hen7.

I'll close this one and try to reopen the other issue #1 and add more related info there.

Oh btw, I like when the developer says "on my machine at least", that's so funny. From my own experience the developer always has to sit on the devOps guy's lap. Anyways, I should have thought twice. Sorry about opening this issue.

Dockerfile

# get the base image
FROM rust:1.55-slim AS build

# install build dependencies
RUN apt update \
  && apt install -y --no-install-recommends lsb-release apt-transport-https \
  build-essential curl

# prepare root project dir
WORKDIR /app

# download the target for wasm
RUN rustup target add wasm32-unknown-unknown

# install wasm-pack
RUN cargo install wasm-pack

# retrieve the src dir
RUN curl https://codeload.github.com/arctic-hen7/perseus-size-opt/tar.gz/main | tar -xz --strip=2 perseus-size-opt-main/examples/simple

# go to src dir
WORKDIR /app/simple

# install perseus-cli
RUN cargo install perseus-cli --version 0.3.0-beta.13

# clean app
RUN perseus clean

# specify deps in app config
RUN sed -i s'/perseus = .*/perseus = "0.3.0-beta.13"/' ./Cargo.toml \
  && sed -i s'/perseus-size-opt = .*/perseus-size-opt = "0.1.0"/' ./Cargo.toml \
  && cat ./Cargo.toml

# modify lib.rs
RUN sed -i s'/SizeOpts::default()/SizeOpts { wee_alloc: true, lto: false, opt_level: "s".to_string(), codegen_units: 1, }/' ./src/lib.rs \
  && sed -i s'/"Hello World!"/"世界您好 !"/' ./src/lib.rs \
  && cat ./src/lib.rs

# run plugin(s) to adjust app
RUN perseus tinker \
  && cat .perseus/Cargo.toml \
  && cat ./src/lib.rs

# deploy app
RUN perseus deploy

# prepare deployment image
FROM bitnami/minideb:buster

WORKDIR /app

COPY --from=build /app/simple/pkg /app/

ENV PERSEUS_STANDALONE=true

ENV HOST=0.0.0.0

CMD ["./server"]

Docker image build

...
Step 10/19 : RUN sed -i s'/perseus = .*/perseus = "0.3.0-beta.13"/' ./Cargo.toml   && sed -i s'/perseus-size-opt = .*/perseus-size-opt = "0.1.0"/' ./Cargo.toml   && cat ./Cargo.toml
 ---> Running in 313267457c82
[package]
name = "perseus-size-opt-example-simple"
version = "0.1.0"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
perseus = "0.3.0-beta.13"
sycamore = "0.6"
perseus-size-opt = "0.1.0"Removing intermediate container 313267457c82
 ---> 153e640b464a
Step 11/19 : RUN sed -i s'/SizeOpts::default()/SizeOpts { wee_alloc: true, lto: false, opt_level: "s".to_string(), codegen_units: 1, }/' ./src/lib.rs   && sed -i s'/"Hello World!"/"世界您好 !"/' ./src/lib.rs   && cat ./src/lib.rs
 ---> Running in 60726b48dec2
use perseus::{define_app, plugins::Plugins, ErrorPages, Template};
use perseus_size_opt::{perseus_size_opt, SizeOpts};
use sycamore::template;

define_app! {
    templates: [
        Template::<G>::new("index").template(|_| {
            template! {
                p { "世界您好 !" }
            }
        })
    ],
    error_pages: ErrorPages::new(|url, status, err, _| {
        template! {
            p { (format!("An error with HTTP code {} occurred at '{}': '{}'.", status, url, err)) }
        }
    }),
    plugins: Plugins::new().plugin(perseus_size_opt(), SizeOpts { wee_alloc: true, lto: false, opt_level: "s".to_string(), codegen_units: 1, })
}
Removing intermediate container 60726b48dec2
 ---> 999599cd539c
Step 12/19 : RUN perseus tinker   && cat .perseus/Cargo.toml   && cat ./src/lib.rs
 ---> Running in 095c4ce2dda9
[package]
name = "perseus-engine"
edition = "2018"
version = "0.3.0-beta.13"
authors = []
keywords = []
categories = []
default-run = "perseus-builder"
autobins = true
autoexamples = true
autotests = true
autobenches = true
publish = true

[workspace]
members = ["server"]

[dependencies]
console_error_panic_hook = "0.1.6"
fs_extra = "1"
futures = "0.3"
lazy_static = "1"
perseus = "0.3.0-beta.13"
serde_json = "1"
sycamore-router = "0.6"
urlencoding = "2.1"
wasm-bindgen-futures = "0.4"
wee_alloc = "0.4"

[dependencies.app]
path = "../"
features = []
optional = false
package = "perseus-size-opt-example-simple"

[dependencies.serde]
version = "1"
features = ["derive"]
optional = false

[dependencies.sycamore]
version = "0.6"
features = ["ssr"]
optional = false

[dependencies.wasm-bindgen]
version = "0.2"
features = ["serde-serialize"]
optional = false

[dependencies.web-sys]
version = "0.3"
features = ["Event", "Headers", "Request", "RequestInit", "RequestMode", "Response", "ReadableStream", "Window"]
optional = false

[lib]
path = "src/lib.rs"
name = "perseus_engine"
test = true
doctest = true
bench = true
doc = true
plugin = false
proc-macro = false
harness = true
edition = "2018"
crate-type = ["cdylib", "rlib"]
required-features = []
[profile.release]
opt-level = "s"
lto = false
codegen-units = 1

[profile.release.package]

[[bin]]
path = "src/bin/build.rs"
name = "perseus-builder"
test = true
doctest = true
bench = true
doc = true
plugin = false
proc-macro = false
harness = true
required-features = []

[[bin]]
path = "src/bin/export.rs"
name = "perseus-exporter"
test = true
doctest = true
bench = true
doc = true
plugin = false
proc-macro = false
harness = true
required-features = []

[[bin]]
path = "src/bin/tinker.rs"
name = "perseus-tinker"
test = true
doctest = true
bench = true
doc = true
plugin = false
proc-macro = false
harness = true
required-features = []
use perseus::{define_app, plugins::Plugins, ErrorPages, Template};
use perseus_size_opt::{perseus_size_opt, SizeOpts};
use sycamore::template;

define_app! {
    templates: [
        Template::<G>::new("index").template(|_| {
            template! {
                p { "世界您好 !" }
            }
        })
    ],
    error_pages: ErrorPages::new(|url, status, err, _| {
        template! {
            p { (format!("An error with HTTP code {} occurred at '{}': '{}'.", status, url, err)) }
        }
    }),
    plugins: Plugins::new().plugin(perseus_size_opt(), SizeOpts { wee_alloc: true, lto: false, opt_level: "s".to_string(), codegen_units: 1, })
}
Removing intermediate container 095c4ce2dda9
 ---> 3c887b091984
Step 13/19 : RUN perseus deploy
 ---> Running in bc462c7b5070
Not running server because `--no-run` was provided. You can run it manually by running the following executable in `.perseus/server/`.
/app/simple/.perseus/target/release/perseus-cli-server

Deployment complete 🚀! Your app is now available for serving in the standalone folder 'pkg'! You can run it by executing the `server` binary in that folder with the `PERSEUS_STANDALONE` environment variable set to `true`.
Removing intermediate container bc462c7b5070
 ---> 483324e4811e

Step 14/19 : FROM bitnami/minideb:buster
 ---> 6ce7b3755a74
Step 15/19 : WORKDIR /app
 ---> Running in a12da1c21c8b
Removing intermediate container a12da1c21c8b
 ---> cc28adcfe317
Step 16/19 : COPY --from=build /app/simple/pkg /app/
 ---> 54f0082a4e79
Step 17/19 : ENV PERSEUS_STANDALONE=true
 ---> Running in 8ff5f3dfafa9
Removing intermediate container 8ff5f3dfafa9
 ---> bcf054b2f66d
Step 18/19 : ENV HOST=0.0.0.0
 ---> Running in 97cda72caadb
Removing intermediate container 97cda72caadb
 ---> 9701c3e7d512
Step 19/19 : CMD ["./server"]
 ---> Running in 706243c33eb7
Removing intermediate container 706243c33eb7
 ---> 630c8ea46299

Successfully built 630c8ea46299
Successfully tagged ...
arctic-hen7 commented 3 years ago

No problem, if there's something I can make clearer in the docs, please let me know!

What's your reasoning for wanting perseus prep to be required before perseus tinker? I'm not sure I fully understand that yet...

phaleth commented 3 years ago

It's alright, btw I'm a PLM dev by trade, so I could write really long and boring articles about this... I guess I could never provide a clear answer.

Anyway, I don't know if perseus prep should be called before perseus tinker during deployment, but I think that alone and even more should be something to consider. Just ask yourself what command names fit here. I think tinker is not a very descriptive name for what could be considered as a lifecycle phase or a deployment stage of a deployment process. Often names like preprocessing, processing and postprocessing are used whenever phases need to have like the most generic names. All I can say is that tinker isn't really saying anything at all and could fit to all of those three generic stages, but only in case tinker was a good name for lifecycle phase, which it isn't.

Maybe perseus deploy also creates the .perseus/ dir if there isn't any. I'm not sure, but really should it be that way? The main reason processes such as a deployment process are split into phases is because of validation. Should there be any validation so those who deploy a Perseus project or any project are less likely to mess up the deployment? The answer is: Sure, if it's a multi step process.

Btw, should the source code be modified by hand before deployment? The answer is: Hell no! Really.... I'm aware wee_alloc imposes such requirement. Maybe that's the root problem or maybe one day perseus tinker will be by default setup such that it can run a sophisticated parser & source code modifier and so take care of all src\lib.rs modifications reliably by itself, because say a Dockerfile itself will never be this sophisticated. I mean how do you always reliably turn this https://github.com/arctic-hen7/perseus/blob/main/examples/tiny/src/lib.rs into this https://github.com/arctic-hen7/perseus-size-opt/blob/main/examples/simple/src/lib.rs considering there could be anything in that lib.rs file and also the fact that the developer won't be bothered by adding all of the optimization plugin related code in particular. wee_alloc only requires that file to be prepended, which is not such a seemingly impossible requirement.

Is perseus tinker meant to do all the preprocessing in the future? Then why not do it all with perseus prep? Maybe cause perseus prep is already taken by something that could be called perseus init as it has more to do with development rather than deployment? I have no clear answer other than tinker was indeed confusing for me.

arctic-hen7 commented 3 years ago

Okay, yeah I can definitely understand that. perseus prep was originally just intended for developing thr CLI itself, and I thought it'd be useful to add it in, but I can see now that it's actually quite confusing. I think I'll do a redesign of the CLI steps to make them more logical, and I'll go through the docs and try to make things clearer!