]> granicus.if.org Git - graphviz/log
graphviz
3 years agoremove commented out code in Autotools Perl detection
Matthew Fernandez [Tue, 25 May 2021 02:07:28 +0000 (19:07 -0700)]
remove commented out code in Autotools Perl detection

3 years agoremove Windows CI configuration of Perl
Matthew Fernandez [Sun, 23 May 2021 01:02:17 +0000 (18:02 -0700)]
remove Windows CI configuration of Perl

As of the previous commit, Perl is no longer necessary for CI on Windows.
Related to #2067.

3 years agoremove check for Perl in the CMake build
Matthew Fernandez [Sun, 23 May 2021 01:29:26 +0000 (18:29 -0700)]
remove check for Perl in the CMake build

Perl is no longer required for the CMake build. Related to #2067.

3 years agocommit generated ps_font_equiv.h and remove generator for this
Matthew Fernandez [Sat, 22 May 2021 23:37:41 +0000 (16:37 -0700)]
commit generated ps_font_equiv.h and remove generator for this

The header ps_font_equiv.h was generated from 3 files, fontmap.cfg,
ps_font_equiv.txt, and ps_fontmap.txt. The generator itself was the Perl file,
mksvgfonts.pl.

The generation process is deterministic and not dependent on the end user’s
system. In fact, ps_font_equiv.h is generated during CI and included in the
portable source tarball. Furthermore the main driving source for this,
ps_font_equiv.txt is no clearer or more commented than the generated header.
Finally, a copy of the generated header was actually already committed to the
repository under windows/include/ for the MSBuild work flow that does not want
to call Perl.

For these reasons, having this as a generated file was no advantage. In fact,
this was a net negative in the build process as it is the only thing in the
build that requires Perl. As of this commit, Perl is no longer required to
build Graphviz. Perl is still necessary for building some optional components
like the Graphviz bindings for Perl.

Closes #2067.

3 years agoMerge branch 'smattr/bc790f2b-e001-4add-8124-a94127742066' into 'main'
Matthew Fernandez [Sat, 29 May 2021 02:37:47 +0000 (02:37 +0000)]
Merge branch 'smattr/bc790f2b-e001-4add-8124-a94127742066' into 'main'

clean up in lib/glcomp

See merge request graphviz/graphviz!1967

3 years agostandardize on float literals for glColor4f and glVertex3f parameters
Matthew Fernandez [Wed, 19 May 2021 03:24:17 +0000 (20:24 -0700)]
standardize on float literals for glColor4f and glVertex3f parameters

Shorter and more readable than GLFloat casts.

3 years agoconsistently use float literals in glCompCalcWidget
Matthew Fernandez [Wed, 19 May 2021 03:17:38 +0000 (20:17 -0700)]
consistently use float literals in glCompCalcWidget

This is more reliable and predictable than the mixture of floats and implicit
conversion from ints that was happening previously.

3 years agoremove unused fs parameter from glCompSetAddNewTexture
Matthew Fernandez [Wed, 19 May 2021 03:09:11 +0000 (20:09 -0700)]
remove unused fs parameter from glCompSetAddNewTexture

3 years agoremove an open coded NULL
Matthew Fernandez [Wed, 19 May 2021 03:08:09 +0000 (20:08 -0700)]
remove an open coded NULL

3 years agoremove commented out code in glcomptexture.c
Matthew Fernandez [Wed, 19 May 2021 03:07:56 +0000 (20:07 -0700)]
remove commented out code in glcomptexture.c

3 years agoremove unused glCompSetClear
Matthew Fernandez [Wed, 19 May 2021 03:04:57 +0000 (20:04 -0700)]
remove unused glCompSetClear

3 years agoremove commented out code in glcompset.c
Matthew Fernandez [Wed, 19 May 2021 03:04:17 +0000 (20:04 -0700)]
remove commented out code in glcompset.c

3 years agoremove commented out change_fonts
Matthew Fernandez [Wed, 19 May 2021 03:02:26 +0000 (20:02 -0700)]
remove commented out change_fonts

3 years agoremove unused glCompSetText
Matthew Fernandez [Wed, 19 May 2021 03:00:14 +0000 (20:00 -0700)]
remove unused glCompSetText

3 years agoremove commented out code in glcompbutton.c
Matthew Fernandez [Wed, 19 May 2021 02:59:44 +0000 (19:59 -0700)]
remove commented out code in glcompbutton.c

3 years agoMerge branch 'smattr/791B36C7-46BD-41BA-A88F-DFC58E2C490A' into 'main'
Matthew Fernandez [Sat, 29 May 2021 01:45:09 +0000 (01:45 +0000)]
Merge branch 'smattr/791B36C7-46BD-41BA-A88F-DFC58E2C490A' into 'main'

squash all -Wfloat-conversion warnings in trackball.c

See merge request graphviz/graphviz!1965

3 years agoconsistently use float arithmetic in build_rotmatrix
Matthew Fernandez [Mon, 17 May 2021 02:39:19 +0000 (19:39 -0700)]
consistently use float arithmetic in build_rotmatrix

By avoiding mixing doubles and floats, we avoid ever down-converting from a
float to a double and losing precision. Squashes some -Wfloat-conversion
warnings.

3 years agoconsistently use float arithmetic in tb_project_to_sphere
Matthew Fernandez [Mon, 17 May 2021 02:37:25 +0000 (19:37 -0700)]
consistently use float arithmetic in tb_project_to_sphere

By avoiding mixing doubles and floats, we avoid ever down-converting from a
float to a double and losing precision. Squashes a -Wfloat-conversion warning.

3 years agorephrase some magic numbers in Smyrna into their originating computation
Matthew Fernandez [Wed, 26 May 2021 15:12:03 +0000 (08:12 -0700)]
rephrase some magic numbers in Smyrna into their originating computation

This removes the use of some double literals with implicit conversion to floats,
squashing some -Wfloat-conversion compiler warnings. It also makes the resulting
code clearer. The compiler constant-folds these at -O1 and above, so there is no
loss of performance. The resulting expressions are slightly different to the
original, but if anything they are a more accurate representation of the intent
here.

3 years agoconsistently use float arithmetic in axis_to_quat
Matthew Fernandez [Mon, 17 May 2021 02:33:11 +0000 (19:33 -0700)]
consistently use float arithmetic in axis_to_quat

By avoiding mixing doubles and floats, we avoid ever down-converting from a
float to a double and losing precision. Squashes some -Wfloat-conversion
warnings.

3 years agousing floats consistently in vscale
Matthew Fernandez [Mon, 17 May 2021 02:31:21 +0000 (19:31 -0700)]
using floats consistently in vscale

By avoiding mixing doubles and floats, we avoid ever down-converting from a
float to a double and losing precision. Squashes a -Wfloat-conversion warning.

3 years agouse more appropriate square root function in vlength
Matthew Fernandez [Mon, 17 May 2021 02:30:00 +0000 (19:30 -0700)]
use more appropriate square root function in vlength

The square root functions sqrt and sqrtf compute on doubles and floats
respectively. Using the float version here avoids a lossy conversion from double
to float when returning from this function.

3 years agoabbreviate some manual fmaxf and fminf operations
Matthew Fernandez [Mon, 17 May 2021 02:29:07 +0000 (19:29 -0700)]
abbreviate some manual fmaxf and fminf operations

3 years agostandardize on float arithmetic in trackball()
Matthew Fernandez [Mon, 17 May 2021 02:27:01 +0000 (19:27 -0700)]
standardize on float arithmetic in trackball()

This function was mixing floats and doubles, leading to mixed precision issues.
Standardizing on float usage throughout leads to more predictable behavior and
removes a number of -Wfloat-conversion warnings.

3 years agoMerge branch 'smattr/d6fdb86c-db15-4eca-815a-07b90f549737' into 'main'
Matthew Fernandez [Sat, 29 May 2021 00:49:52 +0000 (00:49 +0000)]
Merge branch 'smattr/d6fdb86c-db15-4eca-815a-07b90f549737' into 'main'

more clean up of lib/vpsc

See merge request graphviz/graphviz!1972

3 years agopass Rectangles to generateYConstraints as vector of values instead of pointers
Matthew Fernandez [Sat, 22 May 2021 04:44:24 +0000 (21:44 -0700)]
pass Rectangles to generateYConstraints as vector of values instead of pointers

This allows a number of simplifications, most importantly removing manual
allocations in genYConstraints.

3 years agopass Rectangles to generateXConstraints as vector of values instead of pointers
Matthew Fernandez [Sat, 22 May 2021 04:39:30 +0000 (21:39 -0700)]
pass Rectangles to generateXConstraints as vector of values instead of pointers

This allows a number of simplifications, most importantly removing manual
allocations in genXConstraints.

3 years agomake the Rectangles input to generateYConstraints const
Matthew Fernandez [Sat, 22 May 2021 04:34:31 +0000 (21:34 -0700)]
make the Rectangles input to generateYConstraints const

This no longer needs to be mutable.

3 years agomake the Rectangles parameter to generateXConstraints const
Matthew Fernandez [Sat, 22 May 2021 04:33:41 +0000 (21:33 -0700)]
make the Rectangles parameter to generateXConstraints const

This no longer needs to be mutable.

3 years agoput VPSC’s Node class in an anonymous namespace
Matthew Fernandez [Sat, 22 May 2021 04:28:32 +0000 (21:28 -0700)]
put VPSC’s Node class in an anonymous namespace

This marks the class as unnecessary outside of its containing translation unit.
This further emphasizes that is is an implementation detail of the containing
file as well as allowing the compiler to aggressively optimize its layout.

3 years agomanage Node::r as a reference instead of a pointer
Matthew Fernandez [Sat, 22 May 2021 04:26:31 +0000 (21:26 -0700)]
manage Node::r as a reference instead of a pointer

Generally having class members that are references is an anti-pattern. However,
in this case the Node class is only used within generate-constraints.cpp with
all Node objects having limited lifetimes. It is essentially an implementation
detail of generate-constraints.cpp, irrelevant to the outside. Making its
Rectangle member a reference will ease some upcoming changes.

3 years agotake const references in Rectangle::overlap{X|Y} instead of mutable pointers
Matthew Fernandez [Sat, 22 May 2021 04:14:33 +0000 (21:14 -0700)]
take const references in Rectangle::overlap{X|Y} instead of mutable pointers

These functions do not handle nullptr and do not modify their parameter, so a
const reference is more appropriate. This change will ease some future work
towards removing manual memory management.

3 years agotake a vector in generateYConstraints instead of a size and C pointer
Matthew Fernandez [Sat, 22 May 2021 04:06:57 +0000 (21:06 -0700)]
take a vector in generateYConstraints instead of a size and C pointer

Like the previous commit, this is a step towards removing some manual memory
management.

3 years agotake a vector in generateXConstraints instead of size and C pointer
Matthew Fernandez [Sat, 22 May 2021 04:00:29 +0000 (21:00 -0700)]
take a vector in generateXConstraints instead of size and C pointer

This is a stepping stone to removing some manual memory management of the
Rectangles collection.

3 years agoremove unused removeRectangleOverlap()
Matthew Fernandez [Sat, 22 May 2021 03:28:06 +0000 (20:28 -0700)]
remove unused removeRectangleOverlap()

3 years agoMerge branch 'smattr/0C0ECC23-F355-438B-90B0-5CF0B0A7FF0F' into 'main'
Matthew Fernandez [Fri, 28 May 2021 15:35:56 +0000 (15:35 +0000)]
Merge branch 'smattr/0C0ECC23-F355-438B-90B0-5CF0B0A7FF0F' into 'main'

clean up in cmd/gvmap

See merge request graphviz/graphviz!1968

3 years agoremove commented out code in make_map.c
Matthew Fernandez [Thu, 20 May 2021 00:51:06 +0000 (17:51 -0700)]
remove commented out code in make_map.c

3 years agoremove useless flag parameter from get_polygons
Matthew Fernandez [Thu, 20 May 2021 00:46:39 +0000 (17:46 -0700)]
remove useless flag parameter from get_polygons

3 years agoremove some useless return statements
Matthew Fernandez [Thu, 20 May 2021 00:43:37 +0000 (17:43 -0700)]
remove some useless return statements

3 years agoremove useless flag parameter from get_tri
Matthew Fernandez [Thu, 20 May 2021 00:42:51 +0000 (17:42 -0700)]
remove useless flag parameter from get_tri

3 years agoremove unused max_string_length
Matthew Fernandez [Thu, 20 May 2021 00:37:05 +0000 (17:37 -0700)]
remove unused max_string_length

3 years agomake gvmap usage a const char array
Matthew Fernandez [Thu, 20 May 2021 00:35:25 +0000 (17:35 -0700)]
make gvmap usage a const char array

This makes it more obvious to the compiler that it can inline or otherwise
optimize usage of this string.

3 years agouse C99 bools for some boolean gvmap flags
Matthew Fernandez [Thu, 20 May 2021 00:34:15 +0000 (17:34 -0700)]
use C99 bools for some boolean gvmap flags

This leads to slightly clearer and more readable code.

3 years agorephrase an open-coded strdup
Matthew Fernandez [Thu, 20 May 2021 00:30:38 +0000 (17:30 -0700)]
rephrase an open-coded strdup

It is unclear why this was written this way or why it allocated more bytes than
necessary.

3 years agoremove unused (and shadowed) MAX_GRPS
Matthew Fernandez [Thu, 20 May 2021 00:17:02 +0000 (17:17 -0700)]
remove unused (and shadowed) MAX_GRPS

3 years agoremove unused string_split
Matthew Fernandez [Thu, 20 May 2021 00:07:11 +0000 (17:07 -0700)]
remove unused string_split

Apart from being unused, this function has multiple issues:

  1. Comment typo “separater.”
  2. Comment discusses a path returning 1 that does not exist.
  3. Useless return value.
  4. The last store to len in the last loop is dead. This variable is unused
     after this point because the containing loop is exited and it is unused in
     the remainder of the function.
  5. The two mallocs in the last loop over-allocate by one byte. The len
     variable tracking the length of strings being constructed here was
     incremented *past* the '\0' terminator in the previous line. Thus the
     length of the string including '\0' is len, not len + 1.
  6. The allocations in the loop are essentially doing an open-coded strdup (or
     even more efficiently, strndup).
  7. Both the large static buffer swork and the optional larger allocation into
     swork1 are unnecessary. Tracking offset and length in s would allow using
     the original memory as a source to any strndup/strncpy.
  8. The ss allocation reserves one entry too many. The number of tokens is
     ntokens, not ntokens + 1, and this array is not zeroed on allocation so the
     last entry merely contains garbage.

3 years agoremove unused maxlen and MAX_GPRS
Matthew Fernandez [Thu, 20 May 2021 00:05:40 +0000 (17:05 -0700)]
remove unused maxlen and MAX_GPRS

These look to have been copy-pasted from cmd/gvmap/gvmap.c despite not being
used in this file.

3 years agoremove an unused enum
Matthew Fernandez [Thu, 20 May 2021 00:05:06 +0000 (17:05 -0700)]
remove an unused enum

3 years agoMerge branch 'smattr/c6c4b95c-0778-48a4-8cb3-bc41691a30f8' into 'main'
Matthew Fernandez [Fri, 28 May 2021 04:54:34 +0000 (04:54 +0000)]
Merge branch 'smattr/c6c4b95c-0778-48a4-8cb3-bc41691a30f8' into 'main'

clean up in lib/sparse and some minor warning squashing

See merge request graphviz/graphviz!1971

3 years agoremove unused SparseMatrix_import_binary_fp
Matthew Fernandez [Sat, 22 May 2021 01:17:08 +0000 (18:17 -0700)]
remove unused SparseMatrix_import_binary_fp

3 years agoremove unused SparseMatrix_import_binary
Matthew Fernandez [Sat, 22 May 2021 01:16:38 +0000 (18:16 -0700)]
remove unused SparseMatrix_import_binary

3 years agoremove unused SparseMatrix_export_binary_fp
Matthew Fernandez [Sat, 22 May 2021 01:15:45 +0000 (18:15 -0700)]
remove unused SparseMatrix_export_binary_fp

3 years agoremove unused SparseMatrix_export_binary
Matthew Fernandez [Sat, 22 May 2021 01:15:10 +0000 (18:15 -0700)]
remove unused SparseMatrix_export_binary

3 years agoremove unused SparseMatrix_multiply_by_scaler
Matthew Fernandez [Sat, 22 May 2021 01:07:38 +0000 (18:07 -0700)]
remove unused SparseMatrix_multiply_by_scaler

3 years agosquash -Wconversion warning in size_of_matrix_type
Matthew Fernandez [Sat, 22 May 2021 00:54:47 +0000 (17:54 -0700)]
squash -Wconversion warning in size_of_matrix_type

3 years agoremove PriorityQueue alternatives in libsparse
Matthew Fernandez [Sat, 22 May 2021 00:52:54 +0000 (17:52 -0700)]
remove PriorityQueue alternatives in libsparse

Nothing in the build defines PQ, required to enable this code. This is unused,
and has been so for some time.

3 years agosquash a number of -Wconversion warnings in pathexists
Matthew Fernandez [Sat, 22 May 2021 00:42:00 +0000 (17:42 -0700)]
squash a number of -Wconversion warnings in pathexists

3 years agoremove commented out code in visibiilty.c
Matthew Fernandez [Sat, 22 May 2021 00:31:01 +0000 (17:31 -0700)]
remove commented out code in visibiilty.c

3 years agoremove commented out code in route.c
Matthew Fernandez [Sat, 22 May 2021 00:24:03 +0000 (17:24 -0700)]
remove commented out code in route.c

3 years agosquash a -Wconversion warning in Pobspath
Matthew Fernandez [Sat, 22 May 2021 00:20:36 +0000 (17:20 -0700)]
squash a -Wconversion warning in Pobspath

3 years agoMerge branch 'smattr/096A8B9B-9E63-4926-BD55-81876BB90FE4' into 'main'
Matthew Fernandez [Fri, 28 May 2021 04:01:37 +0000 (04:01 +0000)]
Merge branch 'smattr/096A8B9B-9E63-4926-BD55-81876BB90FE4' into 'main'

remove unused fix_fc function

See merge request graphviz/graphviz!1966

3 years agoremove commented out code in gvdevice_webp.c
Matthew Fernandez [Tue, 18 May 2021 00:06:17 +0000 (17:06 -0700)]
remove commented out code in gvdevice_webp.c

3 years agoremove some unnecessary casts
Matthew Fernandez [Tue, 18 May 2021 00:05:49 +0000 (17:05 -0700)]
remove some unnecessary casts

These pointers implicitly coerce.

3 years agoremove commented out code in gvdevice_gd.c
Matthew Fernandez [Tue, 18 May 2021 00:05:32 +0000 (17:05 -0700)]
remove commented out code in gvdevice_gd.c

3 years agoremove unused fix_fc function
Matthew Fernandez [Tue, 18 May 2021 00:05:05 +0000 (17:05 -0700)]
remove unused fix_fc function

3 years agoMerge branch 'smattr/ea22ac16-db22-4ebb-9eaa-ce643d9cbd66' into 'main'
Matthew Fernandez [Fri, 28 May 2021 02:52:08 +0000 (02:52 +0000)]
Merge branch 'smattr/ea22ac16-db22-4ebb-9eaa-ce643d9cbd66' into 'main'

squash some -Wmissing-prototypes warnings

See merge request graphviz/graphviz!1964

3 years agomark create_filtered_list static
Matthew Fernandez [Sun, 16 May 2021 18:42:38 +0000 (11:42 -0700)]
mark create_filtered_list static

This function is not used outside of its containing file. Squashes a
-Wmissing-prototypes warning.

3 years agomark attr_compare static
Matthew Fernandez [Sun, 16 May 2021 18:41:37 +0000 (11:41 -0700)]
mark attr_compare static

This function is not used outside of its containing file. Squashes a
-Wmissing-prototypes warning.

3 years agomark new_attr_ref static
Matthew Fernandez [Sun, 16 May 2021 18:40:39 +0000 (11:40 -0700)]
mark new_attr_ref static

This function is not used outside of its containing file. Squashes a
-Wmissing-prototypes warning.

3 years agomark new_attr_with_ref static
Matthew Fernandez [Sun, 16 May 2021 18:39:39 +0000 (11:39 -0700)]
mark new_attr_with_ref static

This function is not used outside of its containing file. Squashes a
-Wmissing-prototypes warning.

3 years agomark vset static
Matthew Fernandez [Sun, 16 May 2021 18:37:23 +0000 (11:37 -0700)]
mark vset static

This function is not used outside of its containing file. Squashes a
-Wmissing-prototypes warning.

3 years agomark graphml_to_gv static
Matthew Fernandez [Sun, 16 May 2021 18:35:25 +0000 (11:35 -0700)]
mark graphml_to_gv static

This function is not used outside of its containing file. Squashes a
-Wmissing-prototypes warning.

3 years agomark binary() static
Matthew Fernandez [Sun, 16 May 2021 18:29:00 +0000 (11:29 -0700)]
mark binary() static

This function is unused outside of its containing file. Squashes a
-Wmissing-prototypes warning.

3 years agoremove unused newQueue and delQueue
Matthew Fernandez [Sun, 16 May 2021 18:25:42 +0000 (11:25 -0700)]
remove unused newQueue and delQueue

These functions were intended for callers who want to allocate a Queue on the
heap. However, this is unnecessary and callers all locate their Queue objects on
the stack and use mkQueue and freeQueue instead. This removal cleans up the code
a little and squashes two -Wmissing-prototypes warnings.

3 years agoremove unused taper0
Matthew Fernandez [Sun, 16 May 2021 18:15:06 +0000 (11:15 -0700)]
remove unused taper0

This function’s only use is in test code and the header declaring its prototype
is not shipped. It is simpler to omit this (and utility function halffunc) from
the libcommon build entirely. Squashes one -Wmissing-prototypes warning.

3 years agoMerge branch 'smattr/7df6badd-5417-4940-bfc5-1d83cd0ee93b' into 'main'
Matthew Fernandez [Thu, 27 May 2021 15:49:03 +0000 (15:49 +0000)]
Merge branch 'smattr/7df6badd-5417-4940-bfc5-1d83cd0ee93b' into 'main'

some clean up in plugin/core/gvloadimage_core.c

See merge request graphviz/graphviz!1960

3 years agosquash another -Wsign-conversion warning in core_loadimage_ps
Matthew Fernandez [Sat, 15 May 2021 00:42:05 +0000 (17:42 -0700)]
squash another -Wsign-conversion warning in core_loadimage_ps

us->datasize and statbuf.st_size are equal at this point, so we may as well use
the correctly typed one of them.

3 years agosquash a -Wsign-conversion warning in core_loadimage_ps
Matthew Fernandez [Sat, 15 May 2021 00:40:50 +0000 (17:40 -0700)]
squash a -Wsign-conversion warning in core_loadimage_ps

The st_size field is always positive, but is apparently an off_t which then
triggers -Wsign-conversion warnings when being converted to a size_t.

3 years agosquash -Wunused-parameter warnings in core_loadimage_null
Matthew Fernandez [Sat, 15 May 2021 00:37:03 +0000 (17:37 -0700)]
squash -Wunused-parameter warnings in core_loadimage_null

3 years agosquash -Wunused-parameter warning in core_loadimage_tk
Matthew Fernandez [Sat, 15 May 2021 00:36:15 +0000 (17:36 -0700)]
squash -Wunused-parameter warning in core_loadimage_tk

3 years agosquash -Wunused-parameter warning in core_loadimage_vml
Matthew Fernandez [Sat, 15 May 2021 00:35:46 +0000 (17:35 -0700)]
squash -Wunused-parameter warning in core_loadimage_vml

3 years agosquash -Wunused-parameter warning in core_loadimage_ps
Matthew Fernandez [Sat, 15 May 2021 00:35:02 +0000 (17:35 -0700)]
squash -Wunused-parameter warning in core_loadimage_ps

3 years agosquash -Wunused-parameter warnings in core_loadimage_vrml
Matthew Fernandez [Sat, 15 May 2021 00:34:16 +0000 (17:34 -0700)]
squash -Wunused-parameter warnings in core_loadimage_vrml

3 years agosquash -Wunused-parameter warning in core_loadimage_fig
Matthew Fernandez [Sat, 15 May 2021 00:33:19 +0000 (17:33 -0700)]
squash -Wunused-parameter warning in core_loadimage_fig

3 years agoSquash -Wunused-parameter warning in core_loadimage_svg
Matthew Fernandez [Sat, 15 May 2021 00:32:23 +0000 (17:32 -0700)]
Squash -Wunused-parameter warning in core_loadimage_svg

3 years agoMerge branch 'smattr/db55e7bf-5761-43ca-8645-0314c3920597' into 'main'
Matthew Fernandez [Thu, 27 May 2021 15:00:30 +0000 (15:00 +0000)]
Merge branch 'smattr/db55e7bf-5761-43ca-8645-0314c3920597' into 'main'

micro-optimizations in the SVG back end

See merge request graphviz/graphviz!1970

3 years agocompute the extent of some gvputs writes at compile time
Matthew Fernandez [Fri, 21 May 2021 03:50:11 +0000 (20:50 -0700)]
compute the extent of some gvputs writes at compile time

This change teaches the compiler how to unfold gvputs of a string literal into
gvwrite, computing the length of the literal at compile time. This is only
applied to the SVG back end in this commit.

On tests/regression_tests/large/long_chain, this drops the number of gvputs
calls from 2442066 to 363011, though obviously introduces the difference as
gvwrite calls. The total executed instructions drops from 8093310656 to
8009099650, a speed up of ~1%.

3 years agofuse some adjacent gvputs calls
Matthew Fernandez [Fri, 21 May 2021 03:25:00 +0000 (20:25 -0700)]
fuse some adjacent gvputs calls

On tests/regression_tests/large/long_chain this drops the number of gvputs calls
from 2475072 to 2442066, reducing the amount of the trace for which gvputs is
responsible from 6.60% to 6.53%. Total executed instructions are reduced from
8098098396 to 8093310656, a speed up of ~0.05%.

3 years agooptimize two calls to gvprintf with single characters
Matthew Fernandez [Fri, 21 May 2021 02:34:36 +0000 (19:34 -0700)]
optimize two calls to gvprintf with single characters

The expression `gvprintf(j, "%c", x)` is equivalent to `gvwrite(j, &x, 1)`.
However, it seems modern compilers, even with link-time optimization enabled,
are not clever enough to see this equivalence. By unraveling the gvprintf call
to what it eventually bottoms out to, we can accelerate SVG generation.

On tests/regression_tests/large/long_chain, this drops the number of gvprintf
calls from 297008 to 165008, reducing the amount of the trace for which gvprintf
is responsible from 3.27% to 2.24%. Total executed instructions are reduced from
8160974807 to 8098098396, a speed up of ~1%.

3 years agoconvert some gvprintf calls with no format codes to gvputs
Matthew Fernandez [Fri, 21 May 2021 02:21:21 +0000 (19:21 -0700)]
convert some gvprintf calls with no format codes to gvputs

This is equivalent, but gvputs is less expensive to call than gvprintf.
Surprisingly,¹ with link-time optimization a compiler is able to see this
optimization for itself, so this makes no difference to performance in an LTO
build. However, this should be a slight optimization in non-LTO builds.

¹ I say surprisingly because compilers generally do not attempt inter-procedural
  optimization across varargs calls. The calling convention and interpretation
  of arguments is complex enough that they generally conservatively leave such
  calls alone.

3 years agoMerge branch 'smattr/f159e34f-c340-45ea-9a09-9f15224b86fa' into 'main'
Matthew Fernandez [Thu, 27 May 2021 04:19:14 +0000 (04:19 +0000)]
Merge branch 'smattr/f159e34f-c340-45ea-9a09-9f15224b86fa' into 'main'

specialize and accelerate gv_trim_zeros

See merge request graphviz/graphviz!1961

3 years agospecialize and accelerate gv_trim_zeros
Matthew Fernandez [Sat, 15 May 2021 15:58:05 +0000 (08:58 -0700)]
specialize and accelerate gv_trim_zeros

This function trims unnecessary trailing zeros from a printed floating-point
number. It was written to be extremely general, however it is only ever used to
trim a number printed with the format string "%.02f". We can take advantage of
this fact to know that, if it can locate a period, there are exactly two digits
following this that need to be checked. This then allows implementing the
remainder of the function not as a loop but as simply a few branches.

Using tests/regression_tests/large/long_chain, which has been used for other
profiling in this area, this drops total executed instructions from 8160952787
to 8143275099, a speed up of ~2%.

3 years agobroaden 0 check in gvprintdouble
Matthew Fernandez [Sat, 15 May 2021 15:07:20 +0000 (08:07 -0700)]
broaden 0 check in gvprintdouble

The 0 path in this function is, as the comment says, to avoid printing confusing
numbers like -0.00. However, the remainder of the function prints the number to
2 decimal places. So actually any number that *rounds* to -0.00 is going to come
out this way. To avoid this, we can expand the cases where we take an early
exit. This is also a minor performance speed up in these cases, as the 0 path is
faster than the common path.

3 years agoMerge branch 'smattr/0d18cca6-492a-444a-becc-1629ed010728' into 'main'
Matthew Fernandez [Thu, 27 May 2021 03:24:36 +0000 (03:24 +0000)]
Merge branch 'smattr/0d18cca6-492a-444a-becc-1629ed010728' into 'main'

clean up cmd/gvmap/country_graph_coloring.c

See merge request graphviz/graphviz!1969

3 years agoremove initialization of int with a double
Matthew Fernandez [Thu, 20 May 2021 03:48:08 +0000 (20:48 -0700)]
remove initialization of int with a double

It is unclear what this was attempting to achieve.

3 years agoreplace use of ints as bools with C99 bools in country_graph_coloring.c
Matthew Fernandez [Thu, 20 May 2021 03:47:41 +0000 (20:47 -0700)]
replace use of ints as bools with C99 bools in country_graph_coloring.c

3 years agoreplace some use of MIN on doubles with standard fmin
Matthew Fernandez [Thu, 20 May 2021 03:40:51 +0000 (20:40 -0700)]
replace some use of MIN on doubles with standard fmin

3 years agoremove commented out code in country_graph_coloring.c
Matthew Fernandez [Thu, 20 May 2021 03:34:56 +0000 (20:34 -0700)]
remove commented out code in country_graph_coloring.c

3 years agomark country_graph_coloring_internal static
Matthew Fernandez [Thu, 20 May 2021 03:32:30 +0000 (20:32 -0700)]
mark country_graph_coloring_internal static

This function is not used outside of its containing file.

3 years agomark improve_antibandwidth_by_swapping_cheap static
Matthew Fernandez [Thu, 20 May 2021 03:31:19 +0000 (20:31 -0700)]
mark improve_antibandwidth_by_swapping_cheap static

This function is not used outside of its containing file.