Blog post !

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Blog post !

Post by skywalk »

@Fred
I expect optimized C to match ASM for simple stuff. Glad to hear it is working.

I also prefer to run final code from the ide no matter the delay.

My use case for a GetCaller() Macro is to avoid virtual tables with some libs.
I have Structures with embedded Prototypes to a Procedure.
I will wait to see the exposed C or inline C approach.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Blog post !

Post by skywalk »

@Fred - I assume we will have a selection panel or some code switches to set individual C optimizations?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User_Russian
Addict
Addict
Posts: 1518
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: Blog post !

Post by User_Russian »

Fred, what C code will be compiled from this PB code?

Code: Select all

Procedure.s Test(x, y, z.s)
  ProcedureReturn Str(x+y)+z
EndProcedure
Fred wrote:There is a new compiler directive to control optimization from code: 'EnableCodeOptimizer'
GCC supports several levels of optimization (-O0, O1, etc.). Does the directive allow them to be set? Also GCC using __attribute__ can set the level of optimization of a function. Will this be possible in PB?

Code: Select all

__attribute__((optimize("-O2")))
void Test(void)
{
}
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: Blog post !

Post by StarBootics »

Hello everyone,

I have another question : Are the Interface/EndInterface will be impacted by this change ?

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: Blog post !

Post by Tenaja »

jacdelad wrote:Is compilation speed really so important? I only have small projects which never take then more than 3 seconds or something, usually less.
Yes, it is, especially with a bloated system like GCC. For example, I was testing a compiler that generated asm macros, and short short code took very long for their length, with 99 percent of the compilation time in the assembler. It was so significant that I hand wrote my own macro expander... Then compilation was nearly instant.
User avatar
Lord
Addict
Addict
Posts: 900
Joined: Tue May 26, 2009 2:11 pm

Re: Blog post !

Post by Lord »

User_Russian wrote:...
I think that gosub can be abandoned.
...
It's BASIC and should stay BASIC!
jacdelad wrote:Is compilation speed really so important?
...
YES!
Image
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: Blog post !

Post by Keya »

i would've thought GOSUB and GOTO could easily be implemented with a single inline asm call or jmp respectively
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: Blog post !

Post by Tenaja »

Keya wrote:i would've thought GOSUB and GOTO could easily be implemented with a single inline asm call or jmp respectively
It probably can, but I'm with User_Russian... Gosub can be obsoleted. We've got procedures, for crying out loud...
User_Russian
Addict
Addict
Posts: 1518
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: Blog post !

Post by User_Russian »

In C there Goto and its scope as in PB.
That is, there should be no problems.
User avatar
kenmo
Addict
Addict
Posts: 2033
Joined: Tue Dec 23, 2003 3:54 am

Re: Blog post !

Post by kenmo »

I think everyone should relax :D

Fred & team know PureBasic internals better than all of us. They know the pros and cons of what they're doing, and I'm sure they'll make it as backwards-compatible as possible. Also, it's the PB team... you know they love simplified toolchains and fast write-and-run cycles!

It's newly announced, and some people are already asking for specific C output for PB input snippets?! Too soon :)
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: Blog post !

Post by StarBootics »

kenmo wrote:I think everyone should relax :D

Fred & team know PureBasic internals better than all of us. They know the pros and cons of what they're doing, and I'm sure they'll make it as backwards-compatible as possible. Also, it's the PB team... you know they love simplified toolchains and fast write-and-run cycles!

It's newly announced, and some people are already asking for specific C output for PB input snippets?! Too soon :)
I hope you are right, because I don't want to see my Dev-Object program generating broken code for future version of PureBasic. I know I can stick with the 5.73 LTS version from now on but I don't like to do that. That's why I have some questions, and from my perspective it is legitimate considering the many hours of hard work I put in my programming projects already (Dev-Object and my 3D game project just to name a few).

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
Rinzwind
Enthusiast
Enthusiast
Posts: 679
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: Blog post !

Post by Rinzwind »

skywalk wrote:@Fred
My use case for a GetCaller() Macro is to avoid virtual tables with some libs.
I have Structures with embedded Prototypes to a Procedure.
I will wait to see the exposed C or inline C approach.
Exactly why I want the option to extend structures with procedures so we get instance-style programming finally easy for the ones wanting it. Up to now we have to resort to hacks of various complexity and too much boiler plate code... one simple addition...

Also inline array declaration like in c is a must in select use cases...

Also a more efficient string type. Length prefixed. So it can contain binary data to. Never use special data to control the same data (0-termination...). There various c libs available that attempt to solve that while still having backward compatibility where needed.

Open minded :idea:
BarryG
Addict
Addict
Posts: 4127
Joined: Thu Apr 18, 2019 8:17 am

Re: Blog post !

Post by BarryG »

Tenaja wrote:Gosub can be obsoleted. We've got procedures
Don't forget that for speed-critical routines, calling Procedures is slower than using Gosub, and all variables inside a Procedure are set to 0/null when the Procedure starts (unless Global or Shared). I say keep it in for compatibility and speed options.
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: Blog post !

Post by Tenaja »

BarryG wrote:
Tenaja wrote:Gosub can be obsoleted. We've got procedures
Don't forget that for speed-critical routines, calling Procedures is slower than using Gosub, and all variables inside a Procedure are set to 0/null when the Procedure starts (unless Global or Shared). I say keep it in for compatibility and speed options.
There's no such thing as a local variable in a subroutine... So write your procedures with globals, and you have the same call speed... And the same visibility of their variables.
BarryG
Addict
Addict
Posts: 4127
Joined: Thu Apr 18, 2019 8:17 am

Re: Blog post !

Post by BarryG »

[Deleted]
Last edited by BarryG on Tue Mar 16, 2021 6:00 am, edited 4 times in total.
Post Reply