Optimize hex parsing. (#520)

* Optimize hex parsing.

The biggest improvement comes from using a `const` string as table. That avoids (potentially) a lazy initialization check on accessing the `_charFlags`. Also, a constant string may have a fixed location in memory.

Negating the "is valid hex" and putting the bit in bit 7 allows using `entry.toSigned(8)`, which a smart compiler should be able to turn into a single sign-extending opcode.
(Using `(entry & 0x0F) - (entry & 0x80)` works too.)

The `missing_whitespace_between_adjacent_strings` lint doesn't understand that not all strings are text.
Maybe it shouldn't trigger for strings containing character escapes.
3 files changed
tree: 99070f5278fe5a4850451d439d9d42498c033487
  1. .github/
  2. pkgs/
  3. tool/
  4. vendor/
  5. .gitignore
  6. .gitmodules
  7. CONTRIBUTING.md
  8. LICENSE
  9. mono_repo.yaml
  10. README.md
README.md

Build Status

About Shelf

Shelf makes it easy to create and compose web servers and parts of web servers. How?

  • Expose a small set of simple types.
  • Map server logic into a simple function: a single argument for the request, the response is the return value.
  • Trivially mix and match synchronous and asynchronous processing.
  • Flexibility to return a simple string or a byte stream with the same model.

It was inspired by Connect for NodeJS and Rack for Ruby.

See the package:shelf readme for more information.

Packages

PackageDescriptionIssuesVersion
shelfA model for web server middleware that encourages composition and easy reuse.issuespub package
shelf_packages_handlerA shelf handler for serving a packages/ directory.issuespub package
shelf_proxyA shelf handler for proxying HTTP requests to another server.issuespub package
shelf_routerA convenient request router for the shelf web-framework, with support for URL-parameters, nested routers and routers generated from source annotations.issuespub package
shelf_router_generatorA package:build-compatible builder for generating request routers for the shelf web-framework based on source annotations.issuespub package
shelf_staticStatic file server support for the shelf package and ecosystem.issuespub package
shelf_test_handlerA Shelf handler that makes it easy to test HTTP interactions.issuespub package
shelf_web_socketA shelf handler that wires up a listener for every connection.issuespub package
_shelf_complianceHTTP/1.1 compliance and hardening tests.issues(not published)

Publishing automation

For information about our publishing automation and release process, see https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.