Matthew Fernandez [Thu, 29 Dec 2022 19:14:03 +0000 (11:14 -0800)]
neatogen fdpAdjust: remove unused return value
Matthew Fernandez [Thu, 29 Dec 2022 19:11:15 +0000 (11:11 -0800)]
gvmap get_polygon_solids: remove commented out code
Matthew Fernandez [Thu, 29 Dec 2022 19:10:18 +0000 (11:10 -0800)]
gvmap get_polygon_solids: remove unnecessary casts
Matthew Fernandez [Thu, 29 Dec 2022 19:10:00 +0000 (11:10 -0800)]
gvmap get_poly_lines: remove unnecessary cast
Matthew Fernandez [Thu, 29 Dec 2022 19:09:47 +0000 (11:09 -0800)]
gvmap plot_dot_polygons: remove unnecessary cast
Matthew Fernandez [Thu, 29 Dec 2022 19:09:27 +0000 (11:09 -0800)]
gvmap improve_contiguity: remove unnecessary cast
Matthew Fernandez [Thu, 29 Dec 2022 19:08:55 +0000 (11:08 -0800)]
sparse SparseMatrix: use a 'size_t' for 'size'
Squashes 20 -Wsign-conversion, -Wconversion warnings.
Matthew Fernandez [Fri, 30 Dec 2022 00:25:47 +0000 (00:25 +0000)]
Merge branch 'smattr/gitlab-2322' into 'main'
remove gv.php include from PHP demo
Closes #2322
See merge request graphviz/graphviz!3024
Matthew Fernandez [Thu, 29 Dec 2022 22:17:41 +0000 (14:17 -0800)]
remove gv.php include from PHP demo
As of SWIG 4.1.0, PHP source is no longer generated when SWIG is targeting PHP.
Gitlab: closes #2322
Reported-by: Petr Sumbera
Matthew Fernandez [Sun, 25 Dec 2022 21:23:58 +0000 (21:23 +0000)]
Merge branch 'smattr/
0f210128-9f5a-42e9-b2cd-
9a2a16a12a7c' into 'main'
CI: remove Fedora 35 jobs
See merge request graphviz/graphviz!3013
Matthew Fernandez [Sun, 25 Dec 2022 20:33:26 +0000 (12:33 -0800)]
CI: remove Fedora 35 jobs
Fedora 35 has been EOLed since 2022-12-13¹.
¹ https://docs.fedoraproject.org/en-US/releases/eol/
Matthew Fernandez [Sun, 25 Dec 2022 16:57:21 +0000 (16:57 +0000)]
Merge branch 'smattr/
4fc2dbeb-1d26-463e-9258-
c6bbfda1b586' into 'main'
smyrna: remove more unused code
See merge request graphviz/graphviz!3012
Matthew Fernandez [Sun, 25 Dec 2022 02:29:09 +0000 (02:29 +0000)]
Merge branch 'smattr/
441b433a-bf42-4224-b269-
29de6bd0e153' into 'main'
neatogen: fix memory leak
See merge request graphviz/graphviz!3006
Matthew Fernandez [Thu, 22 Dec 2022 03:33:05 +0000 (19:33 -0800)]
neatogen: push queue allocation into 'bfs_bounded'
Similar to the previous commit, the callee does not care about the contents of
the queue on entry and the caller does not care about the contents of the queue
on exit. Note that in this case we need to add an extra parameter because
`bfs_bounded` did not have the queue size already.
Matthew Fernandez [Thu, 22 Dec 2022 03:18:54 +0000 (19:18 -0800)]
neatogen: push queue allocation into 'bfs'
Callers of `bfs` were constructing `Queue` objects and passing them into `bfs`.
But in all of these cases neither the callee nor the caller care about the
contents of the queue. This appears to have been an optimization to hoist
allocation of this object outside loops in callers. This is nowhere close to the
most expensive operation these locations are performing. And replicating
operations like this led to opportunities for errors like that fixed in the
prior commit. It seems a win to undo this for readability.
Matthew Fernandez [Thu, 22 Dec 2022 03:08:15 +0000 (19:08 -0800)]
neatogen embed_graph: fix memory leak of queue
Every call to `mkQueue` is intended to be paired with a call to `freeQueue`.
This function was missing its call to the free function.
Matthew Fernandez [Thu, 22 Dec 2022 03:00:31 +0000 (19:00 -0800)]
neatogen embed_graph: remove free of output parameter
The only call into this function passes `NULL` for the `coords` parameter.
Additionally it did not make much sense to free this pointer on behalf of the
caller. This function is not designed to be called in a loop, so if the caller
wants their passed-in parameter freed they should do it themselves prior to
calling.
Matthew Fernandez [Sun, 25 Dec 2022 01:16:09 +0000 (01:16 +0000)]
Merge branch 'smattr/
9d358411-5cf8-4ba0-90f6-
97c5708027dc' into 'main'
also allow macOS to fail the long chain test
See merge request graphviz/graphviz!3011
Matthew Fernandez [Sat, 24 Dec 2022 22:11:05 +0000 (14:11 -0800)]
smyrna: remove unused 'dlgOpenGraph_OK_Clicked'
The last use of this was removed in
7d1170f8d5208c296db891f5d93bbb158b1c1b56.
Matthew Fernandez [Sat, 24 Dec 2022 22:07:42 +0000 (14:07 -0800)]
smyrna: remove unused 'on_newNode'
This has never been used.
Matthew Fernandez [Sat, 24 Dec 2022 22:05:30 +0000 (14:05 -0800)]
smyrna set_combobox_widget: remove no-op casts
Matthew Fernandez [Sat, 24 Dec 2022 21:53:59 +0000 (13:53 -0800)]
smyrna: remove unused 'nodesize'
Matthew Fernandez [Sat, 24 Dec 2022 21:46:58 +0000 (13:46 -0800)]
smyrna appmouse_up: remove no-op branches
Matthew Fernandez [Sat, 24 Dec 2022 21:44:30 +0000 (13:44 -0800)]
smyrna: remove unused 'prevX', 'prevY'
These have never been used.
Matthew Fernandez [Sat, 24 Dec 2022 21:30:04 +0000 (13:30 -0800)]
gvedit: remove unused 'initFiles'
Matthew Fernandez [Sat, 24 Dec 2022 21:24:25 +0000 (13:24 -0800)]
smyrna: remove disabled test mode code
Matthew Fernandez [Sat, 24 Dec 2022 21:22:52 +0000 (13:22 -0800)]
smyrna: remove unused top view user mode constants
The last use of these was removed in
34d079565882fbffdf58fe61d0f493274438a699.
Matthew Fernandez [Sat, 24 Dec 2022 21:22:03 +0000 (13:22 -0800)]
smyrna: remove unused 'DEFAULT_FISHEYE_MAGNIFIER_RADIUS'
The last use of this was removed in
95730136091ba690f74d1ef802ca42b3cb4ed71c.
Matthew Fernandez [Sat, 24 Dec 2022 21:20:56 +0000 (13:20 -0800)]
smyrna: remove unused magnifier constants
The last use of these was removed in
6baa97a6e98923364f9d1b9a613f2b1aed87fb1b.
Matthew Fernandez [Sat, 24 Dec 2022 21:17:36 +0000 (13:17 -0800)]
also allow macOS to fail the long chain test
It seems this test can also fail in CI on macOS.
Gitlab: #1710, #1720
Matthew Fernandez [Sat, 24 Dec 2022 20:31:59 +0000 (20:31 +0000)]
Merge branch 'smattr/
0ecb9860-22d9-40d2-9f38-
d0e434414c10' into 'main'
smyrna: remove some unused code
See merge request graphviz/graphviz!3005
Matthew Fernandez [Wed, 21 Dec 2022 06:05:56 +0000 (22:05 -0800)]
smyrna: remove unused 'defaultnodeshape'
Matthew Fernandez [Wed, 21 Dec 2022 05:57:16 +0000 (21:57 -0800)]
smyrna: remove unused 'filtered_attr_list'
Matthew Fernandez [Wed, 21 Dec 2022 05:50:44 +0000 (21:50 -0800)]
smyrna: remove unused 'magnifier'
Matthew Fernandez [Wed, 21 Dec 2022 05:46:22 +0000 (21:46 -0800)]
smyrna: remove unused 'fisheye_magnifier'
Matthew Fernandez [Wed, 21 Dec 2022 05:44:47 +0000 (21:44 -0800)]
smyrna: remove unused 'FontSize'
Matthew Fernandez [Wed, 21 Dec 2022 05:42:36 +0000 (21:42 -0800)]
smyrna: remove duplicate 'defaultmagnifierwidth' retrieval
The return value of this call was being ignored. It seems accidentally
copy-pasted from the lines below.
Matthew Fernandez [Wed, 21 Dec 2022 05:39:48 +0000 (21:39 -0800)]
smyrna: remove unused 'topviewusermode'
Matthew Fernandez [Wed, 21 Dec 2022 05:36:49 +0000 (21:36 -0800)]
smyrna: remove unused 'edgerendertype'
Matthew Fernandez [Wed, 21 Dec 2022 05:32:52 +0000 (21:32 -0800)]
smyrna set_viewport_settings_from_template: remove shadowing of 'view' global
Matthew Fernandez [Wed, 21 Dec 2022 05:27:05 +0000 (21:27 -0800)]
smyrna get_attribute_value: remove shadowing of 'view' global
Matthew Fernandez [Wed, 21 Dec 2022 05:26:37 +0000 (21:26 -0800)]
smyrna close_graph: remove shadowing of 'view' global
Matthew Fernandez [Wed, 21 Dec 2022 05:26:04 +0000 (21:26 -0800)]
smyrna clear_viewport: remove shadowing of 'view' global
Matthew Fernandez [Wed, 21 Dec 2022 05:22:19 +0000 (21:22 -0800)]
smyrna add_camera_to_viewport: remove shadowing of 'view' global
Matthew Fernandez [Wed, 21 Dec 2022 05:20:18 +0000 (21:20 -0800)]
smyrna new_viewport_camera: remove unused 'view' parameter
Matthew Fernandez [Wed, 21 Dec 2022 05:18:38 +0000 (21:18 -0800)]
smyrna: squash some -Wmissing-prototypes warnings
Matthew Fernandez [Wed, 21 Dec 2022 05:11:53 +0000 (21:11 -0800)]
symrna: squash -Wunused-parameter warnings in data callbacks
Matthew Fernandez [Wed, 21 Dec 2022 05:09:52 +0000 (21:09 -0800)]
smyrna new_attr: remove shadowing of global 'attr'
Note that none of the zero assignments in this function were necessary because
`gv_alloc` zeros memory.
Matthew Fernandez [Wed, 21 Dec 2022 05:08:47 +0000 (21:08 -0800)]
smyrna new_attr_with_ref: remove shadowing of 'attr' global
Matthew Fernandez [Wed, 21 Dec 2022 05:07:47 +0000 (21:07 -0800)]
smyrna new_attr_ref: remove shadowing of global 'attr'
Matthew Fernandez [Wed, 21 Dec 2022 05:06:34 +0000 (21:06 -0800)]
smyrna attr_list_new: remove unused 'g' parameter
Matthew Fernandez [Wed, 21 Dec 2022 05:00:41 +0000 (21:00 -0800)]
common startElement: remove an unnecessary cast
Matthew Fernandez [Wed, 21 Dec 2022 04:59:35 +0000 (20:59 -0800)]
cgraph: fix comment typo
Matthew Fernandez [Sat, 24 Dec 2022 19:39:23 +0000 (19:39 +0000)]
Merge branch 'smattr/
ae4b501f-6c51-4f2c-8ccb-
b8f433b8685c' into 'main'
common: warning squashing
See merge request graphviz/graphviz!3007
Matthew Fernandez [Fri, 23 Dec 2022 03:43:38 +0000 (19:43 -0800)]
common: remove unnecessary parens
Matthew Fernandez [Fri, 18 Nov 2022 01:14:41 +0000 (17:14 -0800)]
common newItem: use cgraph wrapper for allocation
The lib/cgraph/alloc.h wrappers are similar to the older lib/common/memory.h
wrappers except (1) they are header-only and (2) they live in a directory
(cgraph) that is at the root of the dependency tree. The long term plan is to
replace all use of lib/common/memory.h with lib/cgraph/alloc.h.
Matthew Fernandez [Fri, 18 Nov 2022 01:14:41 +0000 (17:14 -0800)]
common fillMap: use cgraph wrapper for allocation
The lib/cgraph/alloc.h wrappers are similar to the older lib/common/memory.h
wrappers except (1) they are header-only and (2) they live in a directory
(cgraph) that is at the root of the dependency tree. The long term plan is to
replace all use of lib/common/memory.h with lib/cgraph/alloc.h.
Matthew Fernandez [Fri, 23 Dec 2022 03:07:25 +0000 (19:07 -0800)]
common cvtAndAppend: use a more appropriate type for 'len'
Squashes a -Wsign-conversion warning.
Matthew Fernandez [Fri, 23 Dec 2022 03:04:58 +0000 (19:04 -0800)]
common scanEntity: use a more appropriate type for 'len'
This addresses a problem where the subtraction of two pointers, `endp - t`, can
in theory exceed the size of an `int`. In practice this cannot occur, but using
a more correct type squashes a -Wconversion and -Wsign-conversion warning in
this code.
Matthew Fernandez [Fri, 18 Nov 2022 01:14:41 +0000 (17:14 -0800)]
common undoClusterEdges: use cgraph wrapper for allocation
The lib/cgraph/alloc.h wrappers are similar to the older lib/common/memory.h
wrappers except (1) they are header-only and (2) they live in a directory
(cgraph) that is at the root of the dependency tree. The long term plan is to
replace all use of lib/common/memory.h with lib/cgraph/alloc.h.
Matthew Fernandez [Fri, 23 Dec 2022 03:00:30 +0000 (19:00 -0800)]
common undoClusterEdges: remove shadowing of 'elist' global
Matthew Fernandez [Fri, 23 Dec 2022 02:56:37 +0000 (18:56 -0800)]
common gvToggle: squash -Wunused-parameter warning
Matthew Fernandez [Fri, 23 Dec 2022 02:55:25 +0000 (18:55 -0800)]
common late_int: detect and reject int out of range
Squashes a -Wconversion warning.
Matthew Fernandez [Fri, 23 Dec 2022 02:50:57 +0000 (18:50 -0800)]
common new_queue: squash -Wsign-conversion warning
`sz` is known ≥ 2 here.
Matthew Fernandez [Fri, 18 Nov 2022 01:14:41 +0000 (17:14 -0800)]
common new_queue: use cgraph wrappers for allocation
The lib/cgraph/alloc.h wrappers are similar to the older lib/common/memory.h
wrappers except (1) they are header-only and (2) they live in a directory
(cgraph) that is at the root of the dependency tree. The long term plan is to
replace all use of lib/common/memory.h with lib/cgraph/alloc.h.
Matthew Fernandez [Sat, 24 Dec 2022 18:42:08 +0000 (18:42 +0000)]
Merge branch 'smattr/
1b8f5782-a2fc-4215-b3d5-
d82c6944966a' into 'main'
remove some dynamic allocations
See merge request graphviz/graphviz!3009
Matthew Fernandez [Fri, 23 Dec 2022 22:06:11 +0000 (14:06 -0800)]
dotgen _dot_splines: remove unnecessary dynamic allocation of 'P'
Matthew Fernandez [Fri, 23 Dec 2022 21:57:47 +0000 (13:57 -0800)]
common init_job_viewport: remove unnecessary 'junk' string allocation
Matthew Fernandez [Fri, 23 Dec 2022 21:50:19 +0000 (13:50 -0800)]
common taper: return 'stroke_t' by value
Saves unnecessary dynamic allocation and caller clean up.
Matthew Fernandez [Fri, 23 Dec 2022 21:37:04 +0000 (13:37 -0800)]
gxl2gv: remove unnecessary dynamic allocation of user data
Matthew Fernandez [Fri, 23 Dec 2022 21:33:15 +0000 (13:33 -0800)]
gv2gxl: remove unnecessary dynamic allocation of state
Matthew Fernandez [Fri, 23 Dec 2022 21:27:01 +0000 (13:27 -0800)]
graphml2gv: remove unnecessary dynamic allocation of user data
Matthew Fernandez [Fri, 23 Dec 2022 21:12:45 +0000 (13:12 -0800)]
dotgen make_flat_adj_edges: remove unnecessary dynamic allocation of 'attrs'
Matthew Fernandez [Sat, 24 Dec 2022 17:50:34 +0000 (17:50 +0000)]
Merge branch 'smattr/gitlab-1720' into 'main'
fix reading incorrect input in #1710 test case
See merge request graphviz/graphviz!3010
Matthew Fernandez [Fri, 23 Dec 2022 04:16:56 +0000 (20:16 -0800)]
fix reading incorrect input in #1710 test case
A mistake in
632fe0bd1cfc6a4f636db4f85206aff6720bdc6b made this test read from
/dev/null instead of the input file it was supposed to read. Note that this
required some tweak to the skip condition. The Windows platforms on which this
fails seems all over the place and expressing the exact pattern seemed too
complex. For the curious, what we currently see in CI is:
┌──────────────┬─────────┬──────────────┬─────────┬────────┐
│ architecture │ OS │ build system │ mode │ result │
╞══════════════╪═════════╪══════════════╪═════════╪════════╡
│ x86 │ Windows │ MS Build │ debug │ FAIL │
│ │ │ ├─────────┼────────┤
│ │ │ │ release │ pass │
│ │ ├──────────────┼─────────┼────────┤
│ │ │ CMake │ debug │ FAIL │
│ │ │ ├─────────┼────────┤
│ │ │ │ release │ FAIL │
│ ├─────────┼──────────────┼─────────┼────────┤
│ │ MinGW │ CMake │ - │ pass │
├──────────────┼─────────┼──────────────┼─────────┼────────┤
│ x86-64 │ Windows │ CMake │ debug │ FAIL │
│ │ │ ├─────────┼────────┤
│ │ │ │ release │ FAIL │
│ ├─────────┼──────────────┼─────────┼────────┤
│ │ MinGW │ CMake │ - │ FAIL │
└──────────────┴─────────┴──────────────┴─────────┴────────┘
I would not be surprised if these results are not stable. It is likely this
failure presents across all platforms, but is dependent on things like Address
Space Layout Randomization to exhibit.
Gitlab: #1710, #1720
Matthew Fernandez [Fri, 23 Dec 2022 20:20:37 +0000 (20:20 +0000)]
Merge branch 'smattr/
331f7848-cb40-4753-91cb-
c1599c4e3000' into 'main'
Start 7.0.6 development
See merge request graphviz/graphviz!3008
Matthew Fernandez [Fri, 23 Dec 2022 19:32:00 +0000 (11:32 -0800)]
Start 7.0.6 development
Matthew Fernandez [Fri, 23 Dec 2022 19:30:12 +0000 (19:30 +0000)]
Merge branch 'smattr/
26ab1e3b-7718-4870-a101-
5767137531c5' into 'main'
Stable Release 7.0.5
See merge request graphviz/graphviz!3001
Matthew Fernandez [Wed, 14 Dec 2022 16:05:32 +0000 (08:05 -0800)]
Stable Release 7.0.5
Matthew Fernandez [Wed, 21 Dec 2022 05:26:48 +0000 (05:26 +0000)]
Merge branch 'smattr/gitlab-2329' into 'main'
CI: disable Cygwin jobs
See merge request graphviz/graphviz!3004
Matthew Fernandez [Wed, 21 Dec 2022 04:35:00 +0000 (20:35 -0800)]
CI: disable Cygwin jobs
These are currently erroring:
$ wget https://cygwin.com/setup-x86_64.exe -OutFile C:\setup-x86_64.exe
wget : <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access this resource.</p>
</body></html>
At line:1 char:1
+ wget https://cygwin.com/setup-x86_64.exe -OutFile C:\setup-x86_64.exe
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Gitlab: #2329
Matthew Fernandez [Wed, 21 Dec 2022 04:07:47 +0000 (04:07 +0000)]
Merge branch 'smattr/agxbuf-sso' into 'main'
cgraph: implement SSO on agxbuf
Closes #2302 and #2326
See merge request graphviz/graphviz!3003
Matthew Fernandez [Sat, 10 Sep 2022 21:32:15 +0000 (14:32 -0700)]
cgraph agxbuf: make inline strings the default
This change switches both `agxbinit` and zero-initialization (`agxbuf xb = {0}`)
to result in a buffer with inline storage. This means string data is written
inline until it becomes too large to store within the `agxbuf` struct itself,
when it is then relocated to the heap.
This is an optimization. Short dynamic strings can now be written completely
without heap allocation. For example, stringifying a number
(`agxbprint(&xb, "%d", i)`) will fit fully within the inline buffer.
Some performance evaluation comparing the merge-base of this series
(
740c4bf1edba931be0698de7bfde629eba2f40c0) to the current commit follows. These
numbers were derived using `/usr/bin/time` and Valgrind on `-O3 -flto -DNDEBUG`
builds of Graphviz. Instruction counts are provided for examples that are not
too long running.
┌────────┬────────────────────────────┬────────────────────────────┬──────┐
│ │ before │ after │ diff │
├────────┼────────────────────────────┼────────────────────────────┼──────┤
│ chain¹ │ 1.16s │ 1.05s │ -9% │
│ │
10436971652 instructions │
9006483829 instructions │ -14% │
│ │ 444MB peak RSS │ 180MB peak RSS │ -59% │
├────────┼────────────────────────────┼────────────────────────────┼──────┤
│ long² │ 2.69s │ 2.39s │ -11% │
│ │
22856315061 instructions │
19359309874 instructions │ -15% │
│ │ 1056MB peak RSS │ 416MB peak RSS │ -61% │
├────────┼────────────────────────────┼────────────────────────────┼──────┤
│ 456a³ │ 4h16m36s │ 4h13m46s │ -1% │
│ │ 881MB peak RSS │ 861MB peak RSS │ -2% │
├────────┼────────────────────────────┼────────────────────────────┼──────┤
│ 456b⁴ │ 3h57m41s │ 3h59m32s │ +1% │
│ │ 907MB peak RSS │ 886MB peak RSS │ -2% │
├────────┼────────────────────────────┼────────────────────────────┼──────┤
│ 1652a⁵ │ 17.98s │ 17.81s │ -1% │
│ │
113257927412 instructions │
113083410200 instructions │ -0% │
│ │ 97MB peak RSS │ 52MB peak RSS │ -46% │
├────────┼────────────────────────────┼────────────────────────────┼──────┤
│ 1652b⁶ │ 2m09s │ 2m08s │ -1% │
│ │
1697003634008 instructions │
1696880318663 instructions │ -0% │
│ │ 20MB peak RSS │ 16MB peak RSS │ -20% │
├────────┼────────────────────────────┼────────────────────────────┼──────┤
│ 1718⁷ │ 2m34s │ 2m35s │ +1% │
│ │
1620909322870 instructions │
1620889232022 instructions │ -0% │
│ │ 20MB peak RSS │ 18MB peak RSS │ -10% │
├────────┼────────────────────────────┼────────────────────────────┼──────┤
│ 1864a⁸ │ 32m05s │ 34m22s │ +7% │
│ │ 3435MB peak RSS │ 1479MB peak RSS │ -57% │
├────────┼────────────────────────────┼────────────────────────────┼──────┤
│ 1864b⁹ │ 14.68s │ 13.62s │ -7% │
│ │
89053964853 instructions │
83880586677 instructions │ -6% │
│ │ 2421MB peak RSS │ 464MB peak RSS │ -81% │
├────────┼────────────────────────────┼────────────────────────────┼──────┤
│ 2064¹⁰ │ 11m37s │ 11m38s │ +0% │
│ │
815499533953 instructions │
814007887571 instructions │ -0% │
│ │ 1370MB peak RSS │ 1261MB peak RSS │ -8% │
├────────┼────────────────────────────┼────────────────────────────┼──────┤
│ 2095¹¹ │ 2m10s │ 2m11s │ +1% │
│ │
74871386805 instructions │
74549569707 instructions │ -0% │
│ │ 113MB peak RSS │ 92MB peak RSS │ -19% │
└────────┴────────────────────────────┴────────────────────────────┴──────┘
Gitlab: closes #2302
¹ `dot -Tsvg -o /dev/null tests/regression_tests/large/long_chain`.
² “long” in the table is a graph generated by the following script:
print("digraph {")
for i in range(80000):
print(f" N{i} -> N{i + 1}")
print("}")
This represents something like a best case scenario to observe the effect of
this optimization. Lots of small unique strings. Run as
`dot -Tsvg -o /dev/null long.dot`.
³ The test case from https://gitlab.com/graphviz/graphviz/-/issues/456 run as
`dot -Tsvg -o /dev/null 456.dot`. Note that this actually errors out
eventually.
⁴ The test case from https://gitlab.com/graphviz/graphviz/-/issues/456 but with
`concentrate=true` removed. Run as `dot -Tsvg -o /dev/null 456.dot`.
⁵ The test case from https://gitlab.com/graphviz/graphviz/-/issues/1652 run as
`neato -Tsvg -o /dev/null 1652.dot`.
⁶ The test case from https://gitlab.com/graphviz/graphviz/-/issues/1652 run as
`dot -Tsvg -Gnslimit=2.0 -o /dev/null 1652.dot`. Note that this eventually
crashes.
⁷ swedish-flat.dot Magnus attached to
https://gitlab.com/graphviz/graphviz/-/issues/1718 run as
`circo -Tsvg -o /dev/null swedish-flag.dot`.
⁸ The test case from https://gitlab.com/graphviz/graphviz/-/issues/1864 run as
`neato -Tsvg -o /dev/null 1864.dot`.
⁹ The test case from https://gitlab.com/graphviz/graphviz/-/issues/1864 run as
`twopi -Tsvg -o /dev/null 1864.dot`.
¹⁰ The test case from https://gitlab.com/graphviz/graphviz/-/issues/2064 run as
`dot -Gnslimit=2 -Gnslimit1=2 -Gmaxiter=5000 -Tsvg -o /dev/null 2064.dot`.
¹¹The tests/2095.dot test case from prior to minimization
(
3819821ea70fae730dd224936628ed3929b03531). Run as
`dot -Tsvg -o /dev/null 2095.dot`.
Matthew Fernandez [Thu, 15 Dec 2022 16:49:04 +0000 (08:49 -0800)]
cgraph agxbuf: expand usable inline storage
As indicated by the changes to the layout diagram in this diff, previously we
were essentially wasting a number of bytes (3 on x86, 7 on x86-64) on structure
padding. Through some rearrangement and packing, we can make these bytes usable
for the inline storage area.
The definition of the struct is not quite what you might expect to see. The
`located` field is in the first member of the union but is actually used
regardless of what mode an `agxbuf` is in (heap, stack, inline). This is
necessary to get the desired packing. It does not overlap with other struct
fields, though reading and writing a struct through different union members is
well defined in C99.
This optimization might seem a little niche. But `agxbuf` objects are
extensively used. Once inline `agxbuf` objects become possible (an upcoming
commit), this saves us heap allocations in numerous scenarios.
Gitlab: #2302
Matthew Fernandez [Sat, 10 Sep 2022 20:54:55 +0000 (13:54 -0700)]
cgraph agxbuf: support storing short strings inline
This commit implements Small String Optimization (SSO) for `axgbuf`. Strings
up to a certain size (24 bytes unterminated on x86-64) can be stored inline
within an `agxbuf` structure itself with no external backing memory.
There is currently no way to create a buffer in inline mode. Neither
`agxbuf_init` nor zero-initialization gives a path to this. The ability to
create inline strings will be added in an upcoming commit.
When a string is stored inline, its size is maintained in the `located` field
instead of in the `size` field.
Gitlab: #2302
Matthew Fernandez [Thu, 8 Sep 2022 00:27:49 +0000 (17:27 -0700)]
CI: suppress -Wmissing-braces in CentOS 7 CMake build
The compiler on CentOS 7 is an older version of GCC, 4.8.5, which spuriously
issues warnings for code like `foo_t x = {0}` where `foo_t` is a struct
containing an aggregate (array, struct, union). This form of initialization is
meant to be valid for all structs in C99. We need to suppress this to avoid CI
warnings that fail the build in an upcoming commit.
Gitlab: #2302
Matthew Fernandez [Thu, 15 Dec 2022 16:30:20 +0000 (08:30 -0800)]
cgraph agxbuf: remove an open coded 'agxbclear'
This will ease some upcoming changes.
Gitlab: #2302
Matthew Fernandez [Thu, 15 Dec 2022 16:26:21 +0000 (08:26 -0800)]
cgraph agxbuf: rearrange 'agxbclear'
This will enable de-duplicating some code in an upcoming commit.
Gitlab: #2302
Matthew Fernandez [Sat, 10 Sep 2022 20:04:34 +0000 (13:04 -0700)]
cgraph agxbuf: abstract calculation of the capacity of a backing store
This looks a bit like overkill. However, an upcoming commit will make how we
determine this capacity conditional.
Gitlab: #2302
Matthew Fernandez [Sat, 10 Sep 2022 19:04:14 +0000 (12:04 -0700)]
cgraph agxbuf: use an enumerated type for buffer location
This does not change the semantics; 0 still means heap-allocated and 1 means
stack-allocated. However this is preparation for introducing a third location a
buffer can be hosted in.
Gitlab: #2302
Matthew Fernandez [Sat, 10 Dec 2022 04:40:54 +0000 (20:40 -0800)]
cgraph: use size+capacity for agxbuf instead of a pair of pointers
This simplifies some code and will also enable some upcoming optimizations.
Gitlab: #2302
Matthew Fernandez [Sat, 17 Dec 2022 20:00:39 +0000 (12:00 -0800)]
gvpr deparse: avoid accessing agxbuf internals
This eases some upcoming changes to the internal structure of the `agxbuf` type.
This alters the semantics of `deparse` (the buffer’s size ends up 0 on
completion of this function), but this is acceptable as all callers go on to
immediately free the buffer.
Gitlab: #2302
Matthew Fernandez [Sat, 17 Dec 2022 19:57:39 +0000 (11:57 -0800)]
cgraph: simplify error handling to let 'agxbprint' do string clamping
Matthew Fernandez [Sat, 17 Dec 2022 19:53:19 +0000 (11:53 -0800)]
cgraph: avoid accessing agxbuf internals in the scanner
This eases some upcoming changes to the internal structure of the `agxbuf` type.
The trailing calls to `agxbclear` are removed because they are no longer
necessary; the `agxbuse` call does the same thing.
Gitlab: #2302
Matthew Fernandez [Sat, 10 Dec 2022 04:50:53 +0000 (20:50 -0800)]
common protect_rsqb: avoid accessing agxbuf internals
Avoiding this will ease some upcoming changes.
Gitlab: #2302
Matthew Fernandez [Thu, 15 Dec 2022 06:15:37 +0000 (22:15 -0800)]
common: fix invalid use of 'memcpy' in 'printTok'
1349b895eca0bb04855ba46162d0ec7ba3c65010 refactored `printTok` to introduce a
call to `agxbput` that passes in the return value from a previous `agxbuse` on
the same buffer. This pointer still points into the destination buffer and
`agxbput` bottoms out on a call to `memcpy`. So this ends up calling `memcpy`
with overlapping source and destination, something that is undefined behavior in
C.
This change introduces a local alternative for this situation, because this is
the only known place where we need to do such a thing.
Gitlab: #2302, fixes #2326
Matthew Fernandez [Sat, 10 Dec 2022 04:41:44 +0000 (20:41 -0800)]
common protect_rsqb: remove an open coded 'agxblen'
Gitlab: #2302
Matthew Fernandez [Sat, 10 Dec 2022 04:08:04 +0000 (20:08 -0800)]
cgraph: remove initial '\0' store to new agxbuf
Nothing in the code base relies on this. Callers always use `agxbuse` before
relying on the buffer being NUL terminated.
Gitlab: #2302
Matthew Fernandez [Sat, 10 Sep 2022 19:41:51 +0000 (12:41 -0700)]
cgraph agxblen: de-duplicate some logic that was effectively 'agxblen'
Gitlab: #2302
Matthew Fernandez [Sat, 10 Sep 2022 19:31:50 +0000 (12:31 -0700)]
cgraph agxbuf: relocate 'agxblen'
A number of other functions in agxbuf.h open code the logic of `agxblen`. Moving
this function higher in the header will enable us to de-duplicate this code. The
goal here is to fully abstract this, as an upcoming commit will make the way the
length of an `agxbuf` is calculated conditional.
Gitlab: #2302