8000 add benchmarks for normal Dart classes, serialized to JsonBuffers by jakemac53 · Pull Request #153 · dart-archive/macros · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

add benchmarks for normal Dart classes, serialized to JsonBuffers #153

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

jakemac53
Copy link
Contributor
@jakemac53 jakemac53 commented Dec 9, 2024

Part of my quest to validate any assumptions we have been making about extension types and how performant they are :D

Here are the new results:

 SdkMapsJsonWireBenchmark: 1761ms, 7177227 bytes
     SdkMapsBufferWireBenchmark: 1629ms, 5122684 bytes
    SdkMapsBuilderWireBenchmark: 1553ms, 4859868 bytes
      LazyMapsJsonWireBenchmark: 1079ms, 7177227 bytes
    LazyMapsBufferWireBenchmark:  553ms, 5122684 bytes
LazyWrappersBufferWireBenchmark:  432ms, 2111761 bytes
   BuilderMapsJsonWireBenchmark: 1431ms, 7177227 bytes
BuilderMapsBuilderWireBenchmark:  401ms, 2111761 bytes
RegularClassesBufferWireBenchmark:  589ms, 2111761 bytes

     ProcessSdkMapsJsonWireBenchmark:  214ms, hash 23186292
  ProcessLazyMapsBufferWireBenchmark:  282ms, hash 23186292
ProcessLazyWrappersBufferWireBenchmark:  388ms, hash 23186292
ProcessBuilderMapsBuilderWireBenchmark:  381ms, hash 23186292
ProcessRegularClassesBufferWireBenchmark:   17ms, hash 23186292

Note how much faster the processing step is.

If we add up the wire benchmark times and the processing benchmark times, regular classes are faster. This is even though the processing benchmark is actually implemented in a favorable way for the extension types (iterates map entries in order). If you look up by keys, it is much, much slower.

@jakemac53 jakemac53 requested a review from davidmorgan December 9, 2024 20:14
@jakemac53
Copy link
Contributor Author
jakemac53 commented Dec 9, 2024

I would also like to separate the "wire" benchmarks out a bunch, specifically I want to have the following:

  • Benchmark for creating the data (but not serializing it)
  • Benchmark for serializing the already created data
  • Benchmark for deserializing the data (from the serialize benchmark)
  • Benchmark for processing the data (can stay as is, hashing is I think a good example)

This should help demonstrate where each of the benchmarks shine and where they do less well, in more fine grained detail.

@jakemac53 jakemac53 merged commit 587ff2a into main Dec 11, 2024
51 checks passed
@jakemac53 jakemac53 deleted the regular-classes branch December 11, 2024 15:08
@jakemac53 jakemac53 restored the regular-classes branch December 11, 2024 15:08
@jakemac53 jakemac53 deleted the regular-classes branch December 11, 2024 15:08
jakemac53 added a commit that referenced this pull request Dec 13, 2024
… hash (#154)

As mentioned in #153. This gives us a better overall picture of where time is going, in the various modes.

Current results:
```
        SdkMapsJsonWireBenchmark-create:  904ms
      SdkMapsBufferWireBenchmark-create:  711ms
     SdkMapsBuilderWireBenchmark-create:  713ms
       LazyMapsJsonWireBenchmark-create:    0ms
     LazyMapsBufferWireBenchmark-create:    0ms
 LazyWrappersBufferWireBenchmark-create:  420ms
    BuilderMapsJsonWireBenchmark-create:  374ms
 BuilderMapsBuilderWireBenchmark-create:  379ms
        SdkMapsJsonWireBenchmark-serialize:  746ms, 7177227 bytes
      SdkMapsBufferWireBenchmark-serialize:  633ms, 5122684 bytes
     SdkMapsBuilderWireBenchmark-serialize:  667ms, 4859868 bytes
       LazyMapsJsonWireBenchmark-serialize: 1104ms, 7177227 bytes
     LazyMapsBufferWireBenchmark-serialize:  543ms, 5122684 bytes
 LazyWrappersBufferWireBenchmark-serialize:    0ms, 2111761 bytes
    BuilderMapsJsonWireBenchmark-serialize: 1028ms, 7177227 bytes
 BuilderMapsBuilderWireBenchmark-serialize:    0ms, 2111761 bytes
        SdkMapsJsonWireBenchmark-deserialize: 1249ms
      SdkMapsBufferWireBenchmark-deserialize:    0ms
     SdkMapsBuilderWireBenchmark-deserialize:    0ms
       LazyMapsJsonWireBenchmark-deserialize: 1298ms
     LazyMapsBufferWireBenchmark-deserialize:    0ms
 LazyWrappersBufferWireBenchmark-deserialize:    0ms
    BuilderMapsJsonWireBenchmark-deserialize: 1257ms
 BuilderMapsBuilderWireBenchmark-deserialize:    0ms
        SdkMapsJsonWireBenchmark-process:  151ms, hash 23186292
      SdkMapsBufferWireBenchmark-process:  249ms, hash 23186292
     SdkMapsBuilderWireBenchmark-process:  541ms, hash 23186292
       LazyMapsJsonWireBenchmark-process:  179ms, hash 23186292
     LazyMapsBufferWireBenchmark-process:  251ms, hash 23186292
 LazyWrappersBufferWireBenchmark-process:  367ms, hash 23186292
    BuilderMapsJsonWireBenchmark-process:  207ms, hash 23186292
 BuilderMapsBuilderWireBenchmark-process:  364ms, hash 23186292
        SdkMapsJsonWireBenchmark-total: 3050ms
      SdkMapsBufferWireBenchmark-total: 1593ms
     SdkMapsBuilderWireBenchmark-total: 1921ms
       LazyMapsJsonWireBenchmark-total: 2581ms
     LazyMapsBufferWireBenchmark-total:  794ms
 LazyWrappersBufferWireBenchmark-total:  787ms
    BuilderMapsJsonWireBenchmark-total: 2866ms
 BuilderMapsBuilderWireBenchmark-total:  743ms
```
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0