microsoft / qsharp

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

Add images to Deutsch algorithm kata #1578

Closed tcNickolas closed 3 months ago

tcNickolas commented 4 months ago

This closes #1156.

github-actions[bot] commented 4 months ago

Benchmark for e9bd145

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | Array append evaluation | **328.5±2.59µs** | 332.2±3.59µs | **+1.13%** | | Array literal evaluation | **176.8±1.32µs** | 189.3±0.84µs | **+7.07%** | | Array update evaluation | **409.5±1.66µs** | 413.5±2.22µs | **+0.98%** | | Core + Standard library compilation | 19.2±0.90ms | 19.7±0.92ms | +2.60% | | Deutsch-Jozsa evaluation | 5.2±0.07ms | 5.2±0.05ms | 0.00% | | Large file parity evaluation | 34.3±0.10ms | 34.3±0.27ms | 0.00% | | Large input file compilation | 12.7±0.29ms | 12.8±0.27ms | +0.79% | | Large input file compilation (interpreter) | **46.7±1.04ms** | 48.8±1.61ms | **+4.50%** | | Large nested iteration | **32.3±0.22ms** | 32.9±0.98ms | **+1.86%** | | Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample | 1554.5±52.03µs | 1584.1±78.97µs | +1.90% | | Perform Runtime Capabilities Analysis (RCA) on large file sample | **7.8±0.35ms** | 8.0±0.17ms | **+2.56%** | | Perform Runtime Capabilities Analysis (RCA) on teleport sample | 1422.6±100.86µs | 1438.2±84.95µs | +1.10% | | Perform Runtime Capabilities Analysis (RCA) on the core and std libraries | **28.3±1.75ms** | 28.7±0.21ms | **+1.41%** | | Teleport evaluation | 91.4±3.45µs | 90.0±3.44µs | -1.53% |
tcNickolas commented 4 months ago

I redrew images compared to what we have in the classic katas (to remove column vectors and only use ket notations), and that sped up image load significantly compared to the old images - I don't see a noticeable delay in kata load now

billti commented 4 months ago

Do we ever expect katas to support 'themes' or different color backgrounds? These images look fine on a light background, e.g.,

image

But if I switch to a dark background some of the content disappears

image

The SVG is also still a little verbose, but we can optimize that later. (The 3 images are about 150kb, so we wouldn't want to add too many. Looking at the complexity of the image I'm guessing it could be done in about 10kb).

tcNickolas commented 4 months ago

I haven't heard anything about themes support in the katas (personally I don't use dark themes outside of console, since they hurt my eyes). This image is based on the "official" one provided by our designer team (same style, different notations), so I guess we don't have themes at the moment.

I'm happy to accept optimization suggestions, as long as they come with specific commands to do them that can be easily followed by non-designers :-) These images, I got by saving PowerPoint diagram in svg and then scaling them using Figma, and they're a lot smaller than the previous iteration with column vectors, so I'm happy with them. I don't anticipate having more than 5-ish images per kata, and that's only for Grover, most are going to be image-free, so I hope it won't be a problem.

tcNickolas commented 3 months ago

We discussed offline and decided to go ahead with these images as a pilot, unoptimized, and see what the performance looks like on the website. We'll also discuss themes with the website team, whether this is something we want to support.

tcNickolas commented 3 months ago

I used Inkscape to optimize the images automatically, so the three of them are ~68k now.

github-actions[bot] commented 3 months ago

Benchmark for 592d3df

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | Array append evaluation | 333.5±16.87µs | 332.9±4.70µs | -0.18% | | Array literal evaluation | 189.5±0.87µs | **171.6±0.70µs** | **-9.45%** | | Array update evaluation | 414.7±18.53µs | 413.3±3.10µs | -0.34% | | Core + Standard library compilation | 19.4±0.82ms | 19.2±0.52ms | -1.03% | | Deutsch-Jozsa evaluation | 5.1±0.04ms | 5.1±0.05ms | 0.00% | | Large file parity evaluation | 34.0±0.08ms | 34.0±0.13ms | 0.00% | | Large input file compilation | 12.7±0.24ms | 12.6±0.27ms | -0.79% | | Large input file compilation (interpreter) | 49.0±1.28ms | 49.4±1.63ms | +0.82% | | Large nested iteration | 32.9±1.81ms | 32.9±0.44ms | 0.00% | | Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample | 1574.9±46.33µs | 1577.6±46.46µs | +0.17% | | Perform Runtime Capabilities Analysis (RCA) on large file sample | **7.8±0.10ms** | 7.9±0.23ms | **+1.28%** | | Perform Runtime Capabilities Analysis (RCA) on teleport sample | 1438.9±59.42µs | 1437.4±48.79µs | -0.10% | | Perform Runtime Capabilities Analysis (RCA) on the core and std libraries | 28.4±0.36ms | 28.4±0.23ms | 0.00% | | Teleport evaluation | 88.8±3.61µs | 90.6±3.87µs | +2.03% |