v1.15.0
-
Faster request dispatch. A logged route call is ~2.9x faster
(measured in-process,APIRoot.callon a trivial route: 2.76us -> 0.90us).LoggerHandlerno longer builds the formatted log message when nothing
would consume it. Every record reaching the root listener was fully
formatted — timestamp, padded/truncated isolate and logger names, plus a
Zonelookup for the currentAPIRequestid — and then discarded when no
destination (logAllTo/logErrorTo/logDbTo/console) was configured,
which is the default. This was ~1us per record, and a route call emits two
(CALL>andRESPONSE>).APIRouteHandlercaches itsCALL>message andRESPONSE>prefix. Both
are fixed once a route is registered, but were re-interpolated per request
(including stringifying the declaredparametersMap).APIRoot._callImplno longer copies the path parts list just to read the
first one.APIServer.toAPIRequestno longer copies the query-parametersMapa
second time.
-
The
routesbuilder now acceptsconfig:onany/get/post/put/
delete/patch/head, matchingAPIModule.addRoute. Previously an
APIRouteConfigcould only be set throughaddRoute, so per-route logging
could not be turned off through the usual API:routes.get('ping', handler, config: const APIRouteConfig(log: false));
Route logging is on by default and costs roughly 4x the rest of a trivial
dispatch, so this is worth setting on hot routes. -
New
benchmark/suites, with layered breakdowns so a regression can be
attributed rather than just observed. Seebenchmark/README.md.dart run benchmark/bones_api_benchmark.dart # request path dart run benchmark/json_benchmark.dart # JSON request/response dart run benchmark/db_benchmark.dart # DB entity pathThey record that query parsing is well cached (~300x cheaper than parsing)
and SQL generation is under a microsecond. JSON encoding already runs close
to a baredart:convertencode, and request bodies usedart:convert
directly, so no JSON optimization came out of that suite. -
DBSQLMemoryAdapternow answers a select by ID with a direct lookup in the
tableMap, which is already keyed by ID, instead of scanning it. A miss
still falls through to the scan, so results are unchanged.selectByIDwas O(rows) and is now flat: 7.8us -> 7.1us at 10 rows,
9.7us -> 7.2us at 50, and 25.3us -> 7.2us at 400. This mostly speeds up the
test suite and development, since the memory adapter is where those run.