Page 1 of 4

[IDE Tool] pbOptimizer

Posted: Tue Aug 13, 2019 6:43 pm
by chi
Image
With pbOptimizer you can clean up your source code and/or final executable from leftover Comments, Procedures, uncalled PB Libraries and Functions.

This is a beta version! Please report all bugs here... Thank you. Download pbOptimizer.zip (PB 5.7x+, Windows only)



v0.9.8.10
  • disabled "Create .pb" temporarily, as it's error prone (e.g. IncludePath bug) and pretty much useless in its current state. PB removes Macros\Procs (to a degree) internally once the .ASM is created
  • added the ability to use "Editor Constants", "Custom Constants", "Version Info Token" and "Version Info Fields Values" (like #PB_Editor_FileVersionNumeric)
v0.9.8.9
  • fixed compiling with "Create .pb" disabled
  • fixed "Remove Absolute Paths" to be more aggressive (IncludeBinary, IncludePath)
  • fixed linker.config was not applied when creating the ASM file (PB automatically creates a binary file as the .ASM is written)
v0.9.8.8
  • fixed writing the .rc file to disk (Thanks to loulou2522)
  • fixed "Create .asm" checkbox now also toggles "Remove Multiple Spaces"
v0.9.8.7
  • added "Linker options file" support (must be called linker.config)
  • added "Remove Multiple Spaces" for ASM files
  • fixed CompilerIf warnings for PREPROCESS pass
  • added "Exit" button (after compilation is done)
  • open issues: Tokens in Version Info, Generate License.txt
v0.9.8.6
  • fixed ImageEncoder removal
  • added the display of "Called WinAPI Functions" when processing ASM
v0.9.8.5
  • fixed "Remove Uncalled Libs/Funcs" not working properly without having "Remove Comments" selected too
  • fixed ImagePlugins detection
  • added Jpeg2000 support (.jp2)
  • added a MessageBox if the compiled program crashes on execution ("Run Output")
  • renamed "Remove Macro Comments" to "Remove Resolved Macros"
  • some minor fixes
v0.9.8.4
  • fixed a bug with RC files that weren't added when "Include Version Information" was not ticked (Many thanks to Denis for providing me with a project)
  • added a hint for "Open .pb". If you open the same file again and again, you first have to close the file in the IDE or you won't see the update...
v0.9.8.3
  • #PB_Editor_CompileCount, #PB_Editor_BuildCount, #PB_Editor_CreateExecutable are no longer case sensitive
  • IDE file settings are now also applied to the optimized .pb
  • tweaked Macros and Procedures filtering
  • some minor fixes
v0.9.8.2
  • added compatibility with #PB_Editor_CompileCount, #PB_Editor_BuildCount, #PB_Editor_CreateExecutable (read only)
  • added "Remove ImagePlugins" to remove ImagePlugins if the string ".bmp", ".png", ".tga", ... was not found anywhere in the source code
  • added a timer
  • more string concatenations fixed
  • "Remove Uncalled Procedures" is not case sensitive anymore
v0.9.8.1
  • better string concatenation (massive speed improvement)
  • optimized UI responsiveness
  • added a progressbar
v0.9.8.0
  • fixed a bug with _THREAD and _DOUBLE

Re: [IDE Tool] pbOptimizer

Posted: Wed Aug 14, 2019 5:53 am
by skywalk
Can't wait to try! 8)

Re: [IDE Tool] pbOptimizer

Posted: Wed Aug 14, 2019 9:10 am
by dige
Looks promising! :)

I also tried it out with a bigger project, there the optimization runs already since 20min...
Could you still display interim reports or a progress bar to see if the program is still running?

Ciao Dige

Re: [IDE Tool] pbOptimizer

Posted: Wed Aug 14, 2019 12:56 pm
by chi
dige wrote:I also tried it out with a bigger project, there the optimization runs already since 20min...
Over 20min? How many lines did the ASM-part report? Did it finish successfully, though?
dige wrote:Could you still display interim reports or a progress bar to see if the program is still running?
I'll see what I can do ;)

Re: [IDE Tool] pbOptimizer

Posted: Wed Aug 14, 2019 3:55 pm
by chi
updated to v0.9.8.1

Re: [IDE Tool] pbOptimizer

Posted: Thu Aug 15, 2019 7:55 am
by dige
The tested source code has about 100000 lines.
I aborted pbOptimizer after 30min.
The same result with version 0.9.8.1.

Ciao Dige

Re: [IDE Tool] pbOptimizer

Posted: Thu Aug 15, 2019 9:19 am
by BarryG
Using 0.9.8.1 beta, my source is stuck on this for over 5 minutes now:

Image

Re: [IDE Tool] pbOptimizer

Posted: Thu Aug 15, 2019 9:26 am
by dige
After 1 hour and 30 min .. the last output is still "Optimizing..."

Re: [IDE Tool] pbOptimizer

Posted: Thu Aug 15, 2019 11:54 am
by Denis
Hi chi

i don't know how fred do with PB lib.

So, if you remove a call to a PB lib named 'x', and PB use it not directly but inside another lib, how to know that ?
Just a question.

Re: [IDE Tool] pbOptimizer

Posted: Thu Aug 15, 2019 5:19 pm
by chi
dige wrote:The tested source code has about 100000 lines.
I aborted pbOptimizer after 30min.
The same result with version 0.9.8.1.

Ciao Dige
Hard to say... The biggest project I'm testing with is ~12.000 ASM lines and it takes about 20 seconds (0.9.8.1) to compile. With 0.9.8.0 it took 2min. Maybe it's another string problem, but without testing/debugging, it's just a hunch.
BarryG wrote:Using 0.9.8.1 beta, my source is stuck on this for over 5 minutes now:
Always stuck after "String Format"? Was it able to finish? What OS are you on (x86,x64)?
Denis wrote:Hi chi

i don't know how fred do with PB lib.

So, if you remove a call to a PB lib named 'x', and PB use it not directly but inside another lib, how to know that ?
Just a question.
You can see the dependencies when you edit e.g.\PureBasic\PureLibraries\Window = 2DDrawing Desktop VectorDrawing SimpleList Object Gadget Event. pbOptimizer simply filters them and deletes those that are never called.


Does anyone know a big project to test with?

Re: [IDE Tool] pbOptimizer

Posted: Thu Aug 15, 2019 5:34 pm
by Denis
chi wrote:
Denis wrote:Hi chi

i don't know how fred do with PB lib.

So, if you remove a call to a PB lib named 'x', and PB use it not directly but inside another lib, how to know that ?
Just a question.
You can see the dependencies when you edit e.g.\PureBasic\PureLibraries\Window = 2DDrawing Desktop VectorDrawing SimpleList Object Gadget Event. pbOptimizer simply filters them and deletes those that are never called.
What i want to tell is that there are may be hidden reference to this lib that is a lib coulb be called indirectly by another lib not only par it's ows procedures.
chi wrote: Does anyone know a big project to test with?
I will try with my projet PureIconManager (about 65 000 lines) but today if i get enough time.

Re: [IDE Tool] pbOptimizer

Posted: Thu Aug 15, 2019 8:34 pm
by Paul
Gave it a try but it doesn't like Editor Constants...
Image

Maybe it would be a good idea to display an error message and quit instead of listing an error with all the other info in the optimizer window and showing "Optimizing..."
I didn't realize the optimizer was done because it still showed "Optimizing..."


It also removed procedures that were actually being used so the final optimized code would not compile.

Re: [IDE Tool] pbOptimizer

Posted: Fri Aug 16, 2019 1:08 pm
by chi
updated to v0.9.8.2

Re: [IDE Tool] pbOptimizer

Posted: Fri Aug 16, 2019 1:40 pm
by chi
chi wrote:The biggest project I'm testing with is ~12.000 ASM lines and it takes about 20 seconds (0.9.8.1) to compile. With 0.9.8.0 it took 2min.
With 0.9.8.2 it takes 8 seconds to compile ;)

Re: [IDE Tool] pbOptimizer

Posted: Fri Aug 16, 2019 4:41 pm
by Cyllceaux

Code: Select all

LoggerInfo("Version - 0.1."+Str(#pb_editor_buildcount)+"."+Str(#pb_editor_compilecount))
This is some lines of my code.
#pb_editor_buildcount
#pb_editor_compilecount

are PB constants when you activate it.