Why is so slow ???

For everything that's not in any way related to PureBasic. General chat etc...
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Why is so slow ???

Post by StarBootics »

Hello everyone,

98 minutes and 3 seconds compiling then it fail because of a missing header file. My estimate for the total compiling time will be around 2 hours. Why is so slow ??? OK it's a fairly large library, that being said I don't know about how the PureBasic compiler will perform with comparable source code since my largest project has almost 32 000 lines of code and took only few seconds to compile.

I really need find a better way to write good C++ code the first shot otherwise I will loose a lot of time. This is my adventure of the day compiling the OpenCascade library with few extra of my own in it.

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: Why is so slow ???

Post by Shield »

C++ compilers are extremely fast. The problem is that they have to do way too much work
by re-compiling headers over and over again. Unfortunately, this is a known problem that has
its origins in the memory constraints of early computer systems and has been carried on
due to backwards compatibility.

C++ might get module support at some point in time that will address this problem.
In the meantime, buy faster hardware. :P
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
DarkDragon
Addict
Addict
Posts: 2347
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: Why is so slow ???

Post by DarkDragon »

Also don't #include in header files, only in source files. Use forward declaration in header files instead. Also use #pragma once instead of guards (or in combination) where possible.
bye,
Daniel
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: Why is so slow ???

Post by StarBootics »

DarkDragon wrote:Also don't #include in header files, only in source files. Use forward declaration in header files instead. Also use #pragma once instead of guards (or in combination) where possible.
The problem about OpenCascade many classes source code are split in 3 files, *.cxx, *.hxx and *.lxx. So the compiler have to open 3 files most of the time for every classes. Some of these classes has been written back in 1992-93 or so and never been updated since then.

To make a long story short the source code is very old. Even if I'm capable of playing with C++ programming I'm not as good as I'm with PureBasic. It's normal I'm working with PB since version 3.81 if I recall correctly. What I'm doing right now is highly experimental for the moment and modifying 14 627 files is not an easy task.

Edit : Apparently the source I'm trying to use is broken. I'm give it another try if it didn't work I will switch to the OCE (Opencascade Community Edition). I have copied the missing file from this source to make another test.

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: Why is so slow ???

Post by Keya »

a tool like Filemon/Process Monitor might show how long its getting stuck on certain file(s)
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: Why is so slow ???

Post by Shield »

What DarkDragon said is correct, although probably of limited use to you since you did not write the code.
So basically, the only thing you can do is ensure that your hardware is adequate and that your build process
is being paralellized correctly (which depends on the build system you're using). :)
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Why is so slow ???

Post by Fred »

For OGRE compiling (which is very very large) we used precompiled headers and it reduced a lot the compiling time (may be x3)
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: Why is so slow ???

Post by StarBootics »

Hello everyone,

@Shield : For the moment I will have to stick with my current computer since I don't have any money for a better computer.

I'm just beginning with OpenCascade but what I really need is just the modeling part of the library. The stuff needed to make the geometry, the stuff needed to make the topology, the stuff that will use the Topology to make the body (extrusion, revolution and so on) and finally the conversion to a Mesh for rendering.

I think I can drop large portion of the library and keep only the essential. Since I'm under Linux the Direct3D and Windows NT stuff have been dropped already. Tlc/Tk I'm not sure about that just yet but I think it can be dropped too.

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: Why is so slow ???

Post by StarBootics »

Hello everyone,

My journey with OpenCascade continues...
||=== Build failed: 0 error(s), 372 warning(s) (113 minute(s), 7 second(s)) ===|
How I'm supposed to built successfully if the compiler don't telling me where to look ?

Since I have updated my Ubuntu Gnome from 16.04 to 16.10 I'm blocked with PureBasic by this bug http://www.purebasic.fr/english/viewtop ... 23&t=66798

Edit : I got it : failed with error 7!

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: Why is so slow ???

Post by StarBootics »

Hello everyone,

Finally I have found the meaning of the failed with error 7 : It means /* Argument list too long */.
In other words the library is simply too large to be handled by Code::Blocks IDE and generate the *.so file.

Ok now let's study how to use CMake to compile a project.

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Re: Why is so slow ???

Post by jack »

I use Cmake from the terminal, in your case you make a new folder in the oce directory and name the folder build, then cd into that folder and
cmake ..
./configure
make
make test

just for fun I built oce, but the tests failed, so no good.
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: Why is so slow ???

Post by StarBootics »

Hello everyone,

I finally understand my mistake, I'm trying to generate a super-large library, too large for the system to handle. But I have searched the source code folder and have finally found the Code::Blocks workspace file containing many project. Each project generate a library. That was my mistake.

So the real work will start soon. Stay tune !

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Re: Utilizing C++ libraries with PureBasic

Post by fsw »

Hello StarBootics,
Stumbled over this interesting thread.

I hope you got it working and are happy with your achievement.
If you didn't get it working, at least you learned a lot. :)

Now that PureBasic compiles to C, the binding to C++ libraries might be easier...

Take care
fsw

I am to provide the public with beneficial shocks.
Alfred Hitshock
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

Re: Why is so slow ???

Post by BarryG »

StarBootics wrote: Fri Oct 21, 2016 6:46 pm98 minutes and 3 seconds compiling
What's taking that long? PureBasic? You didn't say. If it's PureBasic, then I'm very concerned.
Post Reply