Skip to content

Avoid computing transition tables used for Uri scanning at runtime, instead precompute them and make corelibs use a constant #49108

@mkustermann

Description

@mkustermann

As part of starting an isolate we run bootstrapping code. Part of that will use the Uri class which triggers lazy creation of Uri scanning tables, see sdk/lib/core/uri.dart:

final List<Uint8List> _scannerTables = _createTables();

List<Uint8List> _createTables() {
  // TODO(lrn): Use a precomputed table.
  ... lots of logic here ...
}

=> This is not good for startup latency in general.
=> It is a base cost for any Isolate.spawn(). Making it less appealing to use isolates for short-lived tasks.

The tables can be pre-computed and baked in as a constant into the core libraries, addressing the existing todo in the code.

/cc @lrhn

Metadata

Metadata

Assignees

Labels

area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.library-coretype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)type-performanceIssue relates to performance or code size

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions