Artifactspublic-v0

curl

master
ply4 git calls346 ms288 KiB2 cachedprotocol v2
122 lines3.7 KiBRaw

Performance tests

This directory contains small stand-alone libcurl-using programs that each test specific aspects of the library's performance.

The idea is to have a set of tests here that can be used to verify various libcurl functions' performance when we have no other good means of doing so. Performance is best tested relatively. Does it run slower or faster than before?

Ideally these tests run without using any servers.

base64enc

This test base64 encodes a 256-byte buffer that has every different byte octet represented. Repeatedly in a loop the provided number of times:

./perf base64enc [loops]

base64dec

This test base64 decodes a big encoded string. Repeatedly in a loop the provided number of times:

./perf base64dec [loops]

dateparser

Runs through 180+ date strings and parses them (converts them to epoch time) loops number of times:

./perf dateparser [loops]

maprintf

This test repeatedly formats a request header block with curl_maprintf(), which allocates the result, and measures the time per call. It exercises the allocating output path and a curl_off_t conversion, which the snprintf test does not:

./perf maprintf [loops]

numparser

This test repeatedly converts over a hundred different numbers from a string to binary. Decimal, hexadecimal and octal numbers, each with a set cap. Many numbers hit the cap, some numbers are not syntactically correct.

./perf numparser [loops]

respheaders

This test runs HTTP/1.1 transfers that each receive a canned response over a local socket pair, with no server involved. It reuses the connection and times three responses: a small one, one with the 26 headers a large web site typically sends and one with 200 headers. It exercises the response header parsing and storing:

./perf respheaders [loops]

simpleformat

This test repeatedly formats a commonly used simple message with curl_msnprintf(): literal text plus %s, a size_t and a curl_off_t, with no width or precision. Where snprintf measures an elaborate format, this measures the common one:

./perf simpleformat [loops]

snprintf

This test repeatedly formats a representative string and measures the time per call:

./perf snprintf [loops]

urlencode

This test URL (percent) encodes a 256-byte buffer that has every different byte octet represented. Repeatedly in a loop the provided number of times:

./perf urlencode [loops]

urldecode

This test URL (percent) decodes a 600+ byte buffer. Repeatedly in a loop the provided number of times:

./perf urldecode [loops]

urlparser

Provide this test with a list of many URLs and it times how fast it can parse them: ./perf urlparser URLs.txt [loops]

A test sample of 100K URLs can be found here

wsrecv

This test upgrades a connection to WebSocket over a local socket pair, with no server involved, and receives unmasked binary frames of 16, 125, 1024 and 16384 bytes, the last ones loops / 16 times. Like an application, the write callback calls curl_ws_meta() for each frame to learn its type. It exercises the frame decoding and the delivery of each frame to the application:

./perf wsrecv [loops]

wssend

This test upgrades a connection to WebSocket over a local socket pair, with no server involved, and sends binary frames with curl_ws_send(). It times frames with 16, 125 and 1024 bytes of payload, and one sixteenth as many with 16384 bytes. The other end of the socket pair only reads and drops the data:

./perf wssend [loops]
1<!--
2Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
4SPDX-License-Identifier: curl
5-->
7# Performance tests
9This directory contains small stand-alone libcurl-using programs that each
10test specific aspects of the library's performance.
12The idea is to have a set of tests here that can be used to verify various
13libcurl functions' performance when we have no other good means of doing so.
14Performance is best tested relatively. Does it run slower or faster than
15before?
17Ideally these tests run without using any servers.
19## `base64enc`
21This test base64 encodes a 256-byte buffer that has every different byte octet
22represented. Repeatedly in a loop the provided number of times:
24 ./perf base64enc [loops]
26## `base64dec`
28This test base64 decodes a big encoded string. Repeatedly in a loop the
29provided number of times:
31 ./perf base64dec [loops]
33## `dateparser`
35Runs through 180+ date strings and parses them (converts them to epoch time)
36`loops` number of times:
38 ./perf dateparser [loops]
40## `maprintf`
42This test repeatedly formats a request header block with `curl_maprintf()`,
43which allocates the result, and measures the time per call. It exercises the
44allocating output path and a `curl_off_t` conversion, which the `snprintf`
45test does not:
47 ./perf maprintf [loops]
49## `numparser`
51This test repeatedly converts over a hundred different numbers from a string
52to binary. Decimal, hexadecimal and octal numbers, each with a set cap. Many
53numbers hit the cap, some numbers are not syntactically correct.
55 ./perf numparser [loops]
57## `respheaders`
59This test runs HTTP/1.1 transfers that each receive a canned response over a
60local socket pair, with no server involved. It reuses the connection and
61times three responses: a small one, one with the 26 headers a large web site
62typically sends and one with 200 headers. It exercises the response header
63parsing and storing:
65 ./perf respheaders [loops]
67## `simpleformat`
69This test repeatedly formats a commonly used simple message with
70`curl_msnprintf()`: literal text plus `%s`, a `size_t` and a `curl_off_t`,
71with no width or precision. Where `snprintf` measures an elaborate format,
72this measures the common one:
74 ./perf simpleformat [loops]
76## `snprintf`
78This test repeatedly formats a representative string and measures the time per
79call:
81 ./perf snprintf [loops]
83## `urlencode`
85This test URL (percent) encodes a 256-byte buffer that has every different
86byte octet represented. Repeatedly in a loop the provided number of times:
88 ./perf urlencode [loops]
90## `urldecode`
92This test URL (percent) decodes a 600+ byte buffer. Repeatedly in a loop the
93provided number of times:
95 ./perf urldecode [loops]
97## `urlparser`
99Provide this test with a list of many URLs and it times how fast it can parse
100them: `./perf urlparser URLs.txt [loops]`
102A test sample of 100K URLs can be found
103[here](https://raw.githubusercontent.com/ada-url/url-various-datasets/refs/heads/main/top100/top100.txt)
105## `wsrecv`
107This test upgrades a connection to WebSocket over a local socket pair, with no
108server involved, and receives unmasked binary frames of 16, 125, 1024 and
10916384 bytes, the last ones `loops` / 16 times. Like an application, the write
110callback calls `curl_ws_meta()` for each frame to learn its type. It exercises
111the frame decoding and the delivery of each frame to the application:
113 ./perf wsrecv [loops]
115## `wssend`
117This test upgrades a connection to WebSocket over a local socket pair, with no
118server involved, and sends binary frames with `curl_ws_send()`. It times
119frames with 16, 125 and 1024 bytes of payload, and one sixteenth as many with
12016384 bytes. The other end of the socket pair only reads and drops the data:
122 ./perf wssend [loops]
Diagnostics4 git calls · 346 ms
CallStatusSizeTime0346 ms
discover200152 B3 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=152
git.server.agent=gitty/1.0
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch object-format
git.server.fetch=shallow filter sideband-all
git.protocol.version=2
git.pkt.frames=8
git.pkt.data=6
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=152
git.pkt.payload.max=34
ls-refs200149 B · hit3 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
git.response.bytes=149
git.response.cache=HIT
git.response.duration_ms=3
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=149
git.pkt.payload.max=78
git.ls_refs.count=2
git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=340
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=blob:none
git.fetch.filter.requested=tree:0
git.fetch.filter.fallback=blob:none
git.fetch.filter.learned=false
git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=10
git.pkt.data=8
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=293470
git.pkt.payload.max=65516
git.sideband.band1.bytes=293354
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=87
git.pack.bytes=293354
git.pack.ofs_delta=0
git.pack.ref_delta=1
git.pack.chain.max=1
git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0
git.pack.full=86
Open pack map
fetch2001.6 KiB340 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=1605
git.response.cache=MISS
git.response.duration_ms=340
git.fetch.wants=eebeaeea2051a1fc75c3bb83b5449b6880f61caa
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=1605
git.pkt.payload.max=1584
git.sideband.band1.bytes=1583
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
Ref
refs/heads/master
Commit
31c911efe5652725e930f4d2e60c9060e5f6646d
cf-ray
a5e2f4514c867089
Request
c2511b9c…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format