Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize CodedBufferWriter._copyInto to memcpy #885

Merged
merged 1 commit into from
Oct 23, 2023

Commits on Oct 23, 2023

  1. Optimize CodedBufferWriter._copyInto to memcpy

    dart2wasm currently can't optimize loops into memcpy, however `setRange`
    methods have type tests to generate `array.copy` (Wasm's `memcpy`).
    
    Replacing the loops in `CodedBufferWriter._copyInto` with `setRange`
    improves an internal benchmark extracted from a real use case
    significantly in all targets:
    
    |                              | Before     | After      | Diff                |
    |------------------------------|------------|------------|---------------------|
    | AOT                          | 127,587 us | 95,634 us  | -31,953 us,  -25.0% |
    | JIT                          | 106,880 us | 92,800 us  | -14,080 us,  -13.1% |
    | dart2js -O4                  | 285,587 us | 262,222 us | -23,365 us,  -8.1%  |
    | dart2wasm --omit-type-checks | 337,000 us | 236,100 us | -100,900 us, -29.9% |
    osa1 committed Oct 23, 2023
    Configuration menu
    Copy the full SHA
    397d809 View commit details
    Browse the repository at this point in the history