Skip to content

Benchmark table creation and access - #12293

Merged
sholderbach merged 1 commit into
nushell:mainfrom
sholderbach:table-benchmarks
Mar 26, 2024
Merged

sholderbach merged 1 commit into
nushell:mainfrom
sholderbach:table-benchmarks

Conversation

@sholderbach

Copy link
Copy Markdown
Member

Tables are the most common "large" data structures Nushell itself creates. Benchmarking them and their common operations are central

  • Creation via the explicit [[]; [] []] literal syntax
  • get Access (math sum to guarantee consumption)
  • select Slicing by columns

Currently low column count and high row count as the default example.
Future benchmarks should diversify this and provide tables with irregular column order/presence (as this is currently allowed but rare and requires extra bookkeeping in different commands)

Tables are the most common "large" data structures Nushell itself
creates. Benchmarking them and their common operations are central

- Creation
- Access (`math sum` to guarantee consumption)
- Slicing by columns

Currently low column count and high row count as the default example.
Future benchmarks should diversify this and provide tables with
irregular column order/presence (as this is currently allowed)
@sholderbach

sholderbach commented Mar 26, 2024 •

Copy link
Copy Markdown
Member Author

Missing context on #12252 filled in:

Unboxed record in table

Timer precision: 20 ns
benchmarks     fastest       │ slowest       │ median        │ mean          │ samples │ iters
╰─ table                     │               │               │               │         │
   ├─ create                 │               │               │               │         │
   │  ├─ 1     36.85 µs      │ 122.8 µs      │ 37.54 µs      │ 39.92 µs      │ 100     │ 100
   │  ├─ 10    53.37 µs      │ 165.8 µs      │ 54.26 µs      │ 56.58 µs      │ 100     │ 100
   │  ├─ 100   231.7 µs      │ 368.1 µs      │ 238.7 µs      │ 244.3 µs      │ 100     │ 100
   │  ╰─ 1000  2.132 ms      │ 2.758 ms      │ 2.208 ms      │ 2.23 ms       │ 100     │ 100
   ├─ get                    │               │               │               │         │
   │  ├─ 1     29.37 µs      │ 117.6 µs      │ 30.68 µs      │ 41.51 µs      │ 100     │ 100
   │  ├─ 10    31.54 µs      │ 77.17 µs      │ 32.17 µs      │ 33.74 µs      │ 100     │ 100
   │  ├─ 100   70.72 µs      │ 158.8 µs      │ 72.71 µs      │ 76.19 µs      │ 100     │ 100
   │  ╰─ 1000  462.4 µs      │ 724.4 µs      │ 484.8 µs      │ 493.8 µs      │ 100     │ 100
   ╰─ select                 │               │               │               │         │
      ├─ 1     29.07 µs      │ 84.83 µs      │ 29.97 µs      │ 32.14 µs      │ 100     │ 100
      ├─ 10    39.55 µs      │ 98.23 µs      │ 40.34 µs      │ 42.93 µs      │ 100     │ 100
      ├─ 100   116.8 µs      │ 194.1 µs      │ 121.6 µs      │ 124.7 µs      │ 100     │ 100
      ╰─ 1000  952.4 µs      │ 1.08 ms       │ 988.9 µs      │ 995.6 µs      │ 100     │ 100

After #12252 indirecting from Value to its Record

Timer precision: 20 ns
benchmarks     fastest       │ slowest       │ median        │ mean          │ samples │ iters
╰─ table                     │               │               │               │         │
   ├─ create                 │               │               │               │         │
   │  ├─ 1     42.37 µs      │ 124.7 µs      │ 43.26 µs      │ 46.03 µs      │ 100     │ 100
   │  ├─ 10    58.98 µs      │ 99.24 µs      │ 60.36 µs      │ 61.82 µs      │ 100     │ 100
   │  ├─ 100   213.6 µs      │ 293.5 µs      │ 231.2 µs      │ 232.8 µs      │ 100     │ 100
   │  ╰─ 1000  2.022 ms      │ 2.586 ms      │ 2.111 ms      │ 2.122 ms      │ 100     │ 100
   ├─ get                    │               │               │               │         │
   │  ├─ 1     27.26 µs      │ 69.7 µs       │ 28.13 µs      │ 30.01 µs      │ 100     │ 100
   │  ├─ 10    30.87 µs      │ 97.73 µs      │ 32.43 µs      │ 34.12 µs      │ 100     │ 100
   │  ├─ 100   68.65 µs      │ 152.5 µs      │ 70.22 µs      │ 73.36 µs      │ 100     │ 100
   │  ╰─ 1000  429.9 µs      │ 826.8 µs      │ 503.2 µs      │ 509.3 µs      │ 100     │ 100
   ╰─ select                 │               │               │               │         │
      ├─ 1     26.65 µs      │ 62.34 µs      │ 27.44 µs      │ 29.36 µs      │ 100     │ 100
      ├─ 10    34.98 µs      │ 99.7 µs       │ 36.16 µs      │ 38.8 µs       │ 100     │ 100
      ├─ 100   112.5 µs      │ 224 µs        │ 116.1 µs      │ 121.7 µs      │ 100     │ 100
      ╰─ 1000  866.1 µs      │ 1.26 ms       │ 921.9 µs      │ 927.8 µs      │ 100     │ 100

@FilipAndersson245

Copy link
Copy Markdown
Contributor

Nice, 👍

@sholderbach
sholderbach merged commit b07e206 into nushell:main Mar 26, 2024
@sholderbach
sholderbach deleted the table-benchmarks branch March 26, 2024 17:59
@hustcer hustcer added this to the v0.92.0 milestone Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants