-
-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Making compilation faster #1893
Labels
Milestone
Comments
This was referenced Jun 21, 2021
This was referenced Jun 21, 2021
This was referenced Jun 21, 2021
This was referenced Jul 21, 2021
I think the two leftover tasks of this issue are also done - trsp (#2059), pgr_edge_xy_t (#2062), and this issue can be closed. |
@krashish8 Thanks for reviewing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Making compilation faster
The compilation is slowed down when having an
#include "file.h"
directive on an ".h" or ".hpp" when thefile.h
defines a class or structure, if there is no data created with the class or structure defined in "file.h"In pgRouting C & C++ code use C structures in order to compile due to PostgreSQL been linked with pgRouting's code.
Basically the changes that need to be done are:
Change
Note If the header file has templates leave the line
to:
Add the line:
List of related files/issues:
General working steps:
develop
branch as aDraft
Draft
stateDetailed process
This guideline is written using Unix commands.
Create a fork
To develop is better to do it in your own fork, so first you need to
Create a fork of the repository:
https://github.com/pgRouting/pgrouting/tree/develop/
We call fork to the "copy" of the repository
For example this is Vicky's fork:
https://github.com/cvvergara/pgrouting
Create a clone of your fork
A Clone resides on your computer, for example this is done by Vicky:
The command will create a directory named pgrouting
Go to the root of the repository:
Make sure the work is done on the current contents
First add as a remote the main repository
choose the issue
Branch out from
develop
and name the working branch with the issue you are fixingthe last message will have the:
The issues are related to the files in this directory
https://github.com/pgRouting/pgrouting/blob/develop/include/c_types/
From the file:
https://github.com/pgRouting/pgrouting/blob/master/include/c_types/pgr_edge_t.h#L43
pgr_edge_t
is the one to fix, lets see how much work it implies:which means that that fix will need to affect 144 files (that is why its not a good first issue)
From:
https://github.com/pgRouting/pgrouting/blob/master/include/c_types/matrix_cell_t.h#L41
This is the one that its going to be used as for the guide which is issue #1903
Create the working branch
Create the working branch, and push. making sure that the actions are executed:
Go to your fork and click the "Actions" button
edit the file
Using the editor of your preference, edit the file:
include/c_types/matrix_cell_t.h
Change from:
typedef
struct
wordthe final result:
In some cases originally the code looks like this:
The final result is the same as above
Add the change and commit
you can optionally push, but the actions will fail at this point
The compiler is your best friend
prepare for compilation as follows:
Now, let the compiler tell you the file that needs change:
From the compilation:
there are 2 files that need adjustment:
include/c_common/matrixRows_input.h
src/common/matrixRows_input.c
fixing a header
Always start with the header file in this case
include/c_common/matrixRows_input.h
This needs to be modified, basically instead of the
include
directive have atypedef
https://github.com/pgRouting/pgrouting/blob/develop/include/c_common/matrixRows_input.h#L31
change:
to:
fixing the code
In the C/C++ file is where the
#include "c_types/matrix_cell_t.h"
line should gohttps://github.com/pgRouting/pgrouting/blob/develop/src/common/matrixRows_input.c#L33
preferably before
common
includesFor example after adding to the file
src/common/matrixRows_input.c
the line:compile again
Some times there is a lot of things going on:
But again lets detect the files that need to be modified:
include/drivers/allpairs/floydWarshall_driver.h
#include "c_types/matrix_cell_t.h"
totypedef struct Matrix_cell_t Matrix_cell_t;
#include "c_types/matrix_cell_t.h"
#include "c_common/postgres_connection.h"
line put the new line after itcompile again
the first lines of the error is:
and now detecting
include/allpairs/pgr_allpairs.hpp
as the next file to edit, which is a headerand compile again
include/drivers/allpairs/johnson_driver.h
#include "c_types/matrix_cell_t.h"
totypedef struct Matrix_cell_t Matrix_cell_t;
src/allpairs/johnson.c
#include "c_types/matrix_cell_t.h"
#include "c_common/postgres_connection.h"
line put the new line after itHuston we have a problem:
From the next compilation:
#include "c_types/matrix_cell_t.h"
totypedef struct Matrix_cell_t Matrix_cell_t;
But also change the
matrix_cell
toMatrix_cell_t
to be consistentits time for a break or it compiles completly:
commit and push
Cleaning up the PR
doing a git status yields something like:
The Pull request should have 2 commits at most, during this work 3 commits were done maybe because of a break, maybe to save work done.
That will open an editor with content like:
note: read the help that is on the file
in this example:
is done as follows:
exit the file saving the changes.
It will open another file to edit where the word "some" can be removed. Remove it, and exit the file saving the changes
force the push as follows:
Please inspect the PR #1931 for this demonstration
The text was updated successfully, but these errors were encountered: