microsoft / qsharp

Azure Quantum Development Kit, including the Q# programming language, resource estimator, and Quantum Katas
https://microsoft.github.io/qsharp/
MIT License
367 stars 73 forks source link

Q# Structs: Declaration and Constructor Syntax #1573

Closed ScottCarda-MS closed 3 weeks ago

ScottCarda-MS commented 1 month ago

Declaration and Constructor syntax for Q# structs.

Structs can be declared as namespace items with the following syntax:

struct Pair {
    First : Int,
    Second : Int
}

Structs types that have been declared can be constructed using the following expression syntax:

new Pair { First = 3, Second = 4 }

Additionally, structs can be constructed from other structs using the following copy constructor syntax:

new Pair { ...existing_pair }

and specific fields can be altered while copying:

new Pair { ...existing_pair, Second = 7 }
github-actions[bot] commented 4 weeks ago

Change in memory usage detected by benchmark.

Memory Report for c5bf513d440b625cf330c1119d1703b55102ac17

Test This Branch On Main Difference
compile core + standard lib 16692597 bytes 16616885 bytes 75712 bytes
github-actions[bot] commented 4 weeks ago

Benchmark for c5bf513

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | Array append evaluation | **330.3±1.59µs** | 333.8±12.54µs | **+1.06%** | | Array literal evaluation | **169.9±1.35µs** | 189.5±0.76µs | **+11.54%** | | Array update evaluation | **408.6±1.81µs** | 416.4±2.33µs | **+1.91%** | | Core + Standard library compilation | 21.4±1.05ms | 21.1±0.92ms | -1.40% | | Deutsch-Jozsa evaluation | 5.1±0.06ms | 5.1±0.05ms | 0.00% | | Large file parity evaluation | 34.2±0.15ms | **34.0±0.42ms** | **-0.58%** | | Large input file compilation | 14.4±0.57ms | **13.3±0.49ms** | **-7.64%** | | Large input file compilation (interpreter) | 52.6±1.61ms | 52.3±1.88ms | -0.57% | | Large nested iteration | 32.8±0.57ms | 33.0±0.60ms | +0.61% | | Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample | 1629.6±152.17µs | 1611.2±130.06µs | -1.13% | | Perform Runtime Capabilities Analysis (RCA) on large file sample | 8.3±0.12ms | **8.0±0.12ms** | **-3.61%** | | Perform Runtime Capabilities Analysis (RCA) on teleport sample | 1479.8±154.85µs | 1475.5±141.62µs | -0.29% | | Perform Runtime Capabilities Analysis (RCA) on the core and std libraries | 29.2±0.18ms | **28.8±0.27ms** | **-1.37%** | | Teleport evaluation | 90.4±4.07µs | 88.2±3.76µs | -2.43% |
github-actions[bot] commented 4 weeks ago

Change in memory usage detected by benchmark.

Memory Report for 6a83aec84585bfbfc22ac86358943fb3a800ecd2

Test This Branch On Main Difference
compile core + standard lib 16692597 bytes 16616885 bytes 75712 bytes
github-actions[bot] commented 4 weeks ago

Benchmark for 6a83aec

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | Array append evaluation | 336.0±4.93µs | 335.4±2.20µs | -0.18% | | Array literal evaluation | **170.9±1.73µs** | 189.8±6.20µs | **+11.06%** | | Array update evaluation | **410.8±1.84µs** | 414.5±1.65µs | **+0.90%** | | Core + Standard library compilation | 19.4±0.88ms | 19.2±1.12ms | -1.03% | | Deutsch-Jozsa evaluation | 5.1±0.06ms | 5.1±0.06ms | 0.00% | | Large file parity evaluation | 34.6±0.27ms | **34.1±0.32ms** | **-1.45%** | | Large input file compilation | 13.1±0.91ms | 12.7±0.74ms | -3.05% | | Large input file compilation (interpreter) | 50.6±4.09ms | 50.8±4.08ms | +0.40% | | Large nested iteration | 33.4±0.53ms | **32.8±0.50ms** | **-1.80%** | | Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample | 1584.3±96.10µs | 1576.4±42.23µs | -0.50% | | Perform Runtime Capabilities Analysis (RCA) on large file sample | 8.0±0.21ms | 7.9±0.20ms | -1.25% | | Perform Runtime Capabilities Analysis (RCA) on teleport sample | 1434.2±62.53µs | 1442.1±47.02µs | +0.55% | | Perform Runtime Capabilities Analysis (RCA) on the core and std libraries | 28.2±0.30ms | 28.3±0.42ms | +0.35% | | Teleport evaluation | 88.9±3.82µs | 89.4±3.72µs | +0.56% |
github-actions[bot] commented 4 weeks ago

Change in memory usage detected by benchmark.

Memory Report for 36ee37a0aa29174ac463aa860b0878569a3a0cfc

Test This Branch On Main Difference
compile core + standard lib 16692597 bytes 16616885 bytes 75712 bytes
github-actions[bot] commented 4 weeks ago

Benchmark for 36ee37a

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | Array append evaluation | 337.3±17.48µs | **333.9±2.43µs** | **-1.01%** | | Array literal evaluation | **170.8±6.43µs** | 189.6±1.68µs | **+11.01%** | | Array update evaluation | **411.9±1.64µs** | 415.2±2.19µs | **+0.80%** | | Core + Standard library compilation | **18.5±0.23ms** | 19.2±1.03ms | **+3.78%** | | Deutsch-Jozsa evaluation | 5.1±0.05ms | 5.1±0.04ms | 0.00% | | Large file parity evaluation | 34.2±0.09ms | **34.0±0.74ms** | **-0.58%** | | Large input file compilation | **12.2±0.18ms** | 12.4±0.20ms | **+1.64%** | | Large input file compilation (interpreter) | 46.2±1.99ms | 47.2±1.76ms | +2.16% | | Large nested iteration | 33.0±0.31ms | 33.0±0.22ms | 0.00% | | Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample | 1558.8±28.90µs | 1586.7±53.75µs | +1.79% | | Perform Runtime Capabilities Analysis (RCA) on large file sample | **7.7±0.13ms** | 7.9±0.18ms | **+2.60%** | | Perform Runtime Capabilities Analysis (RCA) on teleport sample | 1419.5±30.06µs | 1438.9±31.86µs | +1.37% | | Perform Runtime Capabilities Analysis (RCA) on the core and std libraries | **27.8±0.16ms** | 28.2±0.16ms | **+1.44%** | | Teleport evaluation | 88.6±3.95µs | 87.4±3.45µs | -1.35% |
github-actions[bot] commented 4 weeks ago

Change in memory usage detected by benchmark.

Memory Report for 215c5bc4d2a8b72fc1e6d0b438f7c312d6001635

Test This Branch On Main Difference
compile core + standard lib 16692597 bytes 16616885 bytes 75712 bytes
github-actions[bot] commented 4 weeks ago

Change in memory usage detected by benchmark.

Memory Report for ab1c2cd871cb6864744c2f80e09d8472555e1a93

Test This Branch On Main Difference
compile core + standard lib 16692597 bytes 16616885 bytes 75712 bytes
github-actions[bot] commented 4 weeks ago

Benchmark for ab1c2cd

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | Array append evaluation | 335.6±2.72µs | **333.7±1.65µs** | **-0.57%** | | Array literal evaluation | 170.6±2.60µs | 172.3±4.73µs | +1.00% | | Array update evaluation | **411.2±2.90µs** | 416.8±1.99µs | **+1.36%** | | Core + Standard library compilation | 18.6±0.12ms | 18.6±0.13ms | 0.00% | | Deutsch-Jozsa evaluation | 5.1±0.05ms | 5.1±0.06ms | 0.00% | | Large file parity evaluation | **34.1±0.09ms** | 34.3±0.40ms | **+0.59%** | | Large input file compilation | 12.3±0.16ms | 12.4±0.17ms | +0.81% | | Large input file compilation (interpreter) | **46.0±0.84ms** | 48.3±1.67ms | **+5.00%** | | Large nested iteration | **32.8±0.17ms** | 33.4±0.22ms | **+1.83%** | | Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample | 1554.5±31.87µs | 1567.5±31.65µs | +0.84% | | Perform Runtime Capabilities Analysis (RCA) on large file sample | **7.7±0.09ms** | 7.9±0.12ms | **+2.60%** | | Perform Runtime Capabilities Analysis (RCA) on teleport sample | 1417.4±29.29µs | 1429.0±29.03µs | +0.82% | | Perform Runtime Capabilities Analysis (RCA) on the core and std libraries | **27.8±0.14ms** | 28.2±0.56ms | **+1.44%** | | Teleport evaluation | 87.8±4.15µs | 87.5±3.82µs | -0.34% |
github-actions[bot] commented 3 weeks ago

Change in memory usage detected by benchmark.

Memory Report for c6ad83d17d77d67610f9bd7709f91d0c9b5a6895

Test This Branch On Main Difference
compile core + standard lib 16692597 bytes 16616885 bytes 75712 bytes
github-actions[bot] commented 3 weeks ago

Benchmark for c6ad83d

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | Array append evaluation | 337.5±2.65µs | **325.6±2.53µs** | **-3.53%** | | Array literal evaluation | **171.2±1.01µs** | 187.4±7.01µs | **+9.46%** | | Array update evaluation | 412.1±3.11µs | **406.1±1.53µs** | **-1.46%** | | Core + Standard library compilation | 20.9±0.80ms | **19.9±0.70ms** | **-4.78%** | | Deutsch-Jozsa evaluation | 5.1±0.07ms | 5.1±0.13ms | 0.00% | | Large file parity evaluation | 34.1±0.08ms | **34.0±0.45ms** | **-0.29%** | | Large input file compilation | 13.2±0.31ms | 13.2±0.39ms | 0.00% | | Large input file compilation (interpreter) | **48.0±1.21ms** | 50.7±1.71ms | **+5.62%** | | Large nested iteration | 32.9±0.59ms | **32.2±0.15ms** | **-2.13%** | | Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample | 1587.1±71.47µs | 1606.8±117.52µs | +1.24% | | Perform Runtime Capabilities Analysis (RCA) on large file sample | **7.9±0.09ms** | 8.0±0.17ms | **+1.27%** | | Perform Runtime Capabilities Analysis (RCA) on teleport sample | 1429.6±33.65µs | 1446.8±74.37µs | +1.20% | | Perform Runtime Capabilities Analysis (RCA) on the core and std libraries | 28.4±0.56ms | 28.4±0.20ms | 0.00% | | Teleport evaluation | 87.7±4.04µs | 89.5±4.99µs | +2.05% |
github-actions[bot] commented 3 weeks ago

Change in memory usage detected by benchmark.

Memory Report for c6db1fd550fe1f2bfb164b951101e07508720fed

Test This Branch On Main Difference
compile core + standard lib 16692597 bytes 16616885 bytes 75712 bytes
github-actions[bot] commented 3 weeks ago

Benchmark for c6db1fd

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | Array append evaluation | 334.2±7.49µs | **326.7±3.29µs** | **-2.24%** | | Array literal evaluation | 186.4±0.55µs | 186.7±0.61µs | +0.16% | | Array update evaluation | 411.5±6.04µs | **407.4±2.33µs** | **-1.00%** | | Core + Standard library compilation | 18.5±0.10ms | 18.4±0.13ms | -0.54% | | Deutsch-Jozsa evaluation | 5.1±0.14ms | 5.1±0.14ms | 0.00% | | Large file parity evaluation | 34.1±0.08ms | **33.9±0.33ms** | **-0.59%** | | Large input file compilation | 12.1±0.07ms | 12.1±0.07ms | 0.00% | | Large input file compilation (interpreter) | **45.1±0.56ms** | 46.7±1.15ms | **+3.55%** | | Large nested iteration | 33.0±0.92ms | 32.3±1.02ms | -2.12% | | Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample | 1559.8±34.55µs | 1573.8±37.77µs | +0.90% | | Perform Runtime Capabilities Analysis (RCA) on large file sample | 7.7±0.09ms | 7.7±0.10ms | 0.00% | | Perform Runtime Capabilities Analysis (RCA) on teleport sample | 1422.0±28.88µs | 1440.7±76.74µs | +1.32% | | Perform Runtime Capabilities Analysis (RCA) on the core and std libraries | 28.1±0.17ms | 28.1±0.21ms | 0.00% | | Teleport evaluation | 90.2±8.60µs | 90.0±4.33µs | -0.22% |
github-actions[bot] commented 3 weeks ago

Change in memory usage detected by benchmark.

Memory Report for 72410efa7c29e47e6165060b193348776e59e264

Test This Branch On Main Difference
compile core + standard lib 16692597 bytes 16616885 bytes 75712 bytes
github-actions[bot] commented 3 weeks ago

Change in memory usage detected by benchmark.

Memory Report for 255e8bc2d138f119f3b8df4aba90b88942ec1dfb

Test This Branch On Main Difference
compile core + standard lib 16692597 bytes 16616885 bytes 75712 bytes
github-actions[bot] commented 3 weeks ago

Change in memory usage detected by benchmark.

Memory Report for e9d5523a006b6eefb971db4965aea05a09acfe12

Test This Branch On Main Difference
compile core + standard lib 16692597 bytes 16616885 bytes 75712 bytes
github-actions[bot] commented 3 weeks ago

Benchmark for e9d5523

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | Array append evaluation | **335.0±2.35µs** | 337.6±15.80µs | **+0.78%** | | Array literal evaluation | 186.7±1.05µs | **172.6±5.44µs** | **-7.55%** | | Array update evaluation | **413.6±3.95µs** | 419.2±3.75µs | **+1.35%** | | Core + Standard library compilation | 22.1±0.88ms | **19.1±0.67ms** | **-13.57%** | | Deutsch-Jozsa evaluation | 5.1±0.15ms | 5.1±0.04ms | 0.00% | | Large file parity evaluation | 34.3±0.28ms | **34.0±0.34ms** | **-0.87%** | | Large input file compilation | 14.2±0.30ms | **12.7±0.52ms** | **-10.56%** | | Large input file compilation (interpreter) | 50.7±2.83ms | **47.1±1.13ms** | **-7.10%** | | Large nested iteration | **32.9±0.19ms** | 33.1±0.20ms | **+0.61%** | | Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample | 1619.6±97.24µs | 1606.2±82.49µs | -0.83% | | Perform Runtime Capabilities Analysis (RCA) on large file sample | 8.3±0.22ms | **8.0±0.32ms** | **-3.61%** | | Perform Runtime Capabilities Analysis (RCA) on teleport sample | 1460.6±107.11µs | 1439.4±50.12µs | -1.45% | | Perform Runtime Capabilities Analysis (RCA) on the core and std libraries | 29.2±0.23ms | **28.6±0.92ms** | **-2.05%** | | Teleport evaluation | 89.5±4.09µs | 90.9±7.32µs | +1.56% |
github-actions[bot] commented 3 weeks ago

Change in memory usage detected by benchmark.

Memory Report for a7c12910e255018f8cd1241d51eebfae6f206583

Test This Branch On Main Difference
compile core + standard lib 16692597 bytes 16616885 bytes 75712 bytes
github-actions[bot] commented 3 weeks ago

Benchmark for a7c1291

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | Array append evaluation | **335.3±1.12µs** | 359.7±2.81µs | **+7.28%** | | Array literal evaluation | 170.8±1.63µs | 171.4±1.18µs | +0.35% | | Array update evaluation | **411.2±1.16µs** | 437.0±2.60µs | **+6.27%** | | Core + Standard library compilation | **19.2±0.65ms** | 20.4±0.59ms | **+6.25%** | | Deutsch-Jozsa evaluation | **5.0±0.05ms** | 5.1±0.04ms | **+2.00%** | | Large file parity evaluation | 34.1±0.10ms | 34.1±0.67ms | 0.00% | | Large input file compilation | **12.3±0.13ms** | 12.9±0.34ms | **+4.88%** | | Large input file compilation (interpreter) | **48.7±1.38ms** | 51.4±1.64ms | **+5.54%** | | Large nested iteration | **32.7±0.14ms** | 35.1±1.15ms | **+7.34%** | | Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample | 1588.1±72.15µs | 1592.8±108.11µs | +0.30% | | Perform Runtime Capabilities Analysis (RCA) on large file sample | 7.9±0.22ms | 7.9±0.12ms | 0.00% | | Perform Runtime Capabilities Analysis (RCA) on teleport sample | 1438.5±66.51µs | 1450.5±83.61µs | +0.83% | | Perform Runtime Capabilities Analysis (RCA) on the core and std libraries | 28.4±0.31ms | 28.4±0.21ms | 0.00% | | Teleport evaluation | 88.5±3.65µs | 90.1±3.98µs | +1.81% |
github-actions[bot] commented 3 weeks ago

Change in memory usage detected by benchmark.

Memory Report for 0372ee1422f55a8e6666a39a470ab6c330067807

Test This Branch On Main Difference
compile core + standard lib 16693925 bytes 16618213 bytes 75712 bytes
github-actions[bot] commented 3 weeks ago

Benchmark for 0372ee1

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | Array append evaluation | 335.4±3.48µs | 337.8±13.23µs | +0.72% | | Array literal evaluation | **171.1±1.83µs** | 189.4±0.83µs | **+10.70%** | | Array update evaluation | **411.0±1.82µs** | 419.0±10.45µs | **+1.95%** | | Core + Standard library compilation | 19.8±0.49ms | **18.7±0.54ms** | **-5.56%** | | Deutsch-Jozsa evaluation | 5.1±0.05ms | 5.1±0.04ms | 0.00% | | Large file parity evaluation | 34.4±0.16ms | 34.3±0.35ms | -0.29% | | Large input file compilation | 12.8±0.44ms | **12.4±0.25ms** | **-3.13%** | | Large input file compilation (interpreter) | 47.2±0.99ms | 48.1±1.77ms | +1.91% | | Large nested iteration | **32.8±0.18ms** | 33.1±0.12ms | **+0.91%** | | Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample | 1565.9±28.83µs | 1584.4±44.41µs | +1.18% | | Perform Runtime Capabilities Analysis (RCA) on large file sample | 8.1±0.10ms | **7.8±0.12ms** | **-3.70%** | | Perform Runtime Capabilities Analysis (RCA) on teleport sample | 1426.1±30.25µs | 1433.9±33.13µs | +0.55% | | Perform Runtime Capabilities Analysis (RCA) on the core and std libraries | **28.0±0.18ms** | 28.3±0.38ms | **+1.07%** | | Teleport evaluation | 88.9±4.07µs | 89.7±8.76µs | +0.90% |