Valence Download V3
V3 is out · the judge ships

Valence

Write code at the speed of thought

A code editor built from nothing in C++17 and Qt 6: its own text buffer, renderer, tokenizer and undo, and a competitive-programming judge that never leaves the window. No Electron. No QTextEdit.

The name above is 14,000 characters of Valence's own source. Move through it, then scroll

01 the whole file

This is Valence.

Every line of it: 6,586 across 31 files, in the order the architecture stacks them — theme, core, editor, judge, interface. You are flying over the real source.

02 its own colours

Lit by its own lexer.

Every token below was classified in this page by a line-for-line port of cpp_highlighter.cpp, in Valence's palette. The port is tested against the C++ itself, compiled and run on every one of these lines.

03 viewport culling

Only the lit band is drawn.

paintEvent walks the visible rows and stops. The band is 46 lines, about one full-height editor. Everything outside it sits in the buffer and costs nothing per frame, which is why a large file paints as fast as a small one.

6,586
lines in the buffer
46
painted this frame
6,540
skipped

text_buffer.cpp the document model

One string per line.

Valence stores a document as std::vector<std::string>. No rope, no piece table. Finding a line is O(1), which the renderer needs dozens of times a frame. Edits pay the price: typing into a line shifts the rest of that line, and splitting a line shifts every line below it. Type in the editor. The right side is the vector, and each edit shows what it moved.

scratch.cpptry cppmain then Tab
Ln 1, Col 1C++

lines_ waiting for an edit

std::string::insert shifts the rest of its line. std::vector::insert moves every later line.

undo_manager.cpp the command pattern

Ctrl+Z undoes words, not characters.

Every edit is recorded as an action. Single-character edits merge into one group while they are the same kind, next to each other, on the same side of a word boundary, and at most 400 ms apart. Anything else opens a new group. The towers are the undo and redo stacks, live.

Type in the editor above.

cpp_highlighter.cpp the tokenizer

Every character goes somewhere.

One pass, left to right, no regex, no backtracking. The scan head crosses the line once; each time it closes a token, that token's characters leave for the lane of their type. These are Valence's rules, ported branch for branch, down to the one that knows 1'000'000'007 is a number and not a character literal.

    Measured in C++: about 500 ns per line of real code, two million lines a second on one core (benchmark).

    src/ architecture

    Six layers. Each leans only on what is below it.

    Theme at the foundation, then the core data structures, the editor, the judge, the interface, and the entry point. Each tower is one file; its height is its lines of code. The light running through it is a single keystroke, following the calls it really makes. Drag to turn it.

    judge.cpp competitive programming

    Compile once. Run every case. Never freeze.

    Ctrl+Enter saves, compiles with g++ -O2 -std=gnu++17, and pipes every test case through the binary: AC, WA, TLE, RE or CE. A runaway solution is killed at the time limit and the editor never blocks. These are real runs, recorded and replayed at their real speed. The verdicts are worked out in your browser from the recorded output, by the judge's own comparison rule.

    
          

    Pick a solution and run it.

      The rule, exactly.

      Trailing spaces, tabs and carriage returns on each line are ignored, and so are trailing blank lines. Everything else must match, including case. Edit either side.

      bench.txt performance

      Measured, including where it breaks.

      Timed in C++ against Valence's real TextBuffer, UndoManager and CppHighlighter: 26 September 2026, g++ 13.1 -O2, Windows x64. Before V3, every keystroke re-tokenized the whole file to track block comments, and at 50,000 lines that alone overran the frame. V3 rescans from the edited line and stops as soon as the comment state stops changing. Pick a file size.

      Logic only; QPainter's drawing time is in none of these. Before-V3 figures: benchmark-2026-09-26.txt (benchmark/benchmark.cpp). V3 figures: keystroke-v3-2026-09-26.json (tools/bench/keystroke_v3.cpp, V3's rebuild reproduced line for line), median of three runs. Log scale.

      git log history

      Sixty commits. Three releases.

      Valence V3 for Windows.

      A native installer for Windows 10 and 11, x64. The judge needs g++ on your PATH; everything else is in the box.

      Built by Sudhanshu Shukla.

      wrong answer: wrong device

      That's a desktop editor.

      Valence is a native Windows app. Your phone will download it, stare at it, and do absolutely nothing with it. We'd send you to your PC, but who are we to judge?

      (We are exactly who. Judging is the headline feature of V3.)

      Download anyway