Skip to content

Test: Duel 0.2.0 on Linux, macOS and Windows - #1

Closed
sferik wants to merge 7 commits into
masterfrom
duel-0.2-ci-test
Closed

sferik wants to merge 7 commits into
masterfrom
duel-0.2-ci-test

Conversation

@sferik

@sferik sferik commented Nov 16, 2026

Copy link
Copy Markdown
Owner

A test of the workflows for ged#771, before they go there. I'll close it once they pass.

larskanis and others added 6 commits November 7, 2026 18:14
Otherwise a race condition could happen, like so:

```
/home/runner/work/ruby-pg/ruby-pg/spec/pg/tuple_spec.rb:316: [BUG] Segmentation fault at 0x0000000000000028
ruby 3.1.7p261 (2025-03-26 revision 0a3704f218) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0004 p:---- s:0014 e:000013 CFUNC  :each
c:0003 p:---- s:0011 e:000010 CFUNC  :to_h
c:0002 p:0004 s:0007 e:000006 BLOCK  /home/runner/work/ruby-pg/ruby-pg/spec/pg/tuple_spec.rb:316 [FINISH]
c:0001 p:---- s:0003 e:000002 (none) [FINISH]
```
Materialize PG::Tuple objects when freezing and undef PG::Tuple.new
PostgreSQL prints IPv4-mapped and IPv4-compatible IPv6 addresses in
dotted form, like ::ffff:1.2.3.4. The decoder chose AF_INET whenever
the text contained a dot, so inet_pton() rejected these values and
decoding raised TypeError.

Choose AF_INET6 when the text contains a colon instead.
Decode IPv4-mapped IPv6 addresses in PG::TextDecoder::Inet
Duel (https://github.com/sferik/duel-ruby) runs the benchmarks in duel/
on the branch and on master side by side, and fails a pull request that
is slower or allocates more. The 44 benchmarks cover queries over a
socket to a PostgreSQL server of each worker's own (exec, exec_params,
exec_prepared, COPY in and out), reading results in memory (values,
getvalue, each, each_row, tuples, field names), the type maps, the text
and binary coders on their own, escaping, and parsing connection
parameters.

Each version compiles its own extension (c.build). The duel-postgresql
plugin needs a released pg, so Duel is in an optional Gemfile group.

Checked by comparing master with itself three times, and with planted
regressions: the Integer decoder without its fast path failed 6
benchmarks on instructions, and an extra rb_str_dup in the String
decoder failed 13 on allocations.
pg's code paths differ by system, and Linux's was the only one Duel
measured. The Perf workflow runs on Linux, macOS and Windows now, each
saying what it found in a report of its own, and the Perf comment
workflow comments with all three.

On Linux and macOS, it calls Duel 0.2.0's reusable workflow, so the
copy of its steps is gone. Its steps are Unix shell's, so the Windows
job runs the same ones itself, in bash, with what pg's build needs
there as source-gem.yml has it (MSYS2's gcc, and PostgreSQL's
binaries). The Perf comment workflow calls Duel's reusable one too.
@sferik

sferik commented Nov 16, 2026

Copy link
Copy Markdown
Owner Author

Done: the workflows are on ged#771 now.

@sferik sferik closed this Nov 16, 2026
@sferik
sferik deleted the duel-0.2-ci-test branch November 16, 2026 19:24
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