I'm gonna have to rework some of the error types.
Why did I need this? Because one of the benchmarks I run is the test suite, and running the test suite thousands of times generates a lot of useless output when it is verbose by default.
Like...
❯ cargo bench -q -p iocaine-vial -- tests 2>/dev/null | wc -l
1998432
That's almost two million completely useless loglines.
With quiet tests, the performance is up by 30% too. But the best thing is that the logs are useful now, because only the Criterion progress is shown, and errors - no noise.
Given the following output():
fn output(request: Request, decision: Decision) -> Result[Response, Report] {
let response = Response.empty();
Ok(response)
}
iocaine 4 benchmarks the http::Request + http::Response variant at ~77ns, while the dummy variant is ~17ns.
I'll go and benchmark iocaine3's output() too, out of curiosity.
God daaamn, iocaine3 is glacial to compile in release mode. All that LTO and codegen-units = 1 is really eating into the compilation time. Also, ~3GiB of RAM gobbled up by rustc ain't fun.
iocaine4's release profile is... less aggressive.
Oh. Okay, neat. iocaine3's no-op output() clocks in at ~120ns / response, so slower than iocaine4's! That's nice.
...and the "dummy" script in the iocaine repo uses ai.robots.txt's haproxy-block-ai-bots.txt, and excludes some of the too-generic bots.
First steps towards new NSoE!
Unfortunately, the same Roto issue I reported the other day also makes it impossible to structure NSoE in the way I want, and I ran into another weirdness too.
Will report my findings later, I want to get to a reasonable place in my script restructuring first.
After applying a hacky workaround to unblock myself:
❯ cargo run -q -- self-test -v 2>/dev/null
1..11
ok 1 dep.nam_shub_of_enki.pkg.checks.ai_robots_txt.ai_robots_txt
ok 2 dep.nam_shub_of_enki.pkg.checks.faked_browser.faked_browser
ok 3 dep.nam_shub_of_enki.pkg.checks.poisoned_urls.poisoned_url
ok 4 dep.nam_shub_of_enki.pkg.tests.decide_curl_ok
ok 5 dep.nam_shub_of_enki.pkg.tests.output_default_ok
ok 6 pkg.unit_tests.ipprefix
ok 7 pkg.unit_tests.maxmind_default
ok 8 pkg.unit_tests.regex_default
ok 9 pkg.unit_tests.report
ok 10 pkg.unit_tests.secchua
ok 11 pkg.unit_tests.secchua_default
Now that looks nice! I can have the tests near the check, right there and then and all that. This will make it easier to tangle these out, too.
http-server default {
bind-to "127.0.0.1:42069"
script {
module "nam_shub_of_enki" path="nam-shub-of-enki"
// None of the configuration is effective yet!
//
// This is *only* here to feel out how the configuration might look in
// the future.
configuration {
set ai.robots.txt::botlist-file "assets/ai.robots.txt-botlist.txt"
append-to ai.robots.txt::excluded-bots "Dot" "nbot" "Operator" "Spider"
append-to poisoned-urls::identifiers "abrakadabra"
}
}
}
I think I like this, though I'm a bit torn on what kind syntax I want to support for lists: do I just... list all the items, like above? Or do I make the items children, like below:
append-to ai.robots.txt::excluded-bots {
- Dot
- nbot
- Operator
- Spider
}
...or do I support both, because depending on the number of items, or the context, either one can make more sense than the other.
ai.robots.txt::excluded-bots {
- Dot
- nbot
}
ai.robots.txt::excluded-bots + {
- Operator
- GPTBot
}
ai.robots.txt::excluded-bots - GPTBot
+ and append would add items, - and remove would remove them, and no-argument or set would set the list to that particular value. Values can either be children in the { - item } format, or arguments for the node itself, whichever feels more comfy when writing.
Bwaahahaha.