It is currently Fri May 24, 2013 5:46 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 61 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject: Re: simple speed optimization request
PostPosted: Wed Jan 18, 2012 10:00 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Dec 20, 2003 6:19 pm
Posts: 467
Location: Switzerland
freak wrote:
> Oddly, PB has them exactly opposite of every "modern" programming language...except maybe some interpreted junk.

You mean such junk as Java?

Although I wouldn't call Java modern, how can you call that
"junk"? :|

freak wrote:
The zero initialization has been part of the language from the very beginning. And as we pointed out its costs are minimal. So it is not going to change.

How about adding an option for warnings if a variable has
been initialized properly? Then at least we wouldn't have
such errors as these in our codes:
Code:
Procedure.s a()
  Protected s.s
  If 1 And 0 ; seriously complicated condition
    s = "hi there"
  EndIf
 
  ProcedureReturn PeekS(@s)
EndProcedure

Debug a()

And later add the not-to-zero-init part

_________________
Athlon64 3700+, 1024MB Ram, Radeon X1600


Top
 Profile  
 
 Post subject: Re: simple speed optimization request
PostPosted: Wed Jan 18, 2012 10:17 pm 
Offline
Enthusiast
Enthusiast

Joined: Tue Nov 09, 2010 10:15 pm
Posts: 794
freak wrote:
> Oddly, PB has them exactly opposite of every "modern" programming language...except maybe some interpreted junk.

You mean such junk as Java?


Java is no longer interpreted... and its speed is not matched by anything except C, on a Linux benchmark. In fact, it has a very small penalty, according to this benchmark:
http://shootout.alioth.debian.org/u64q/ ... &lang2=gcc
Maybe somebody has the "free time" to see how PB stacks up.

Well, let's see, C, Java, C++, GO!, these are all "modern," in the sense that they are heavily used in "modern times" (or backed by a big organization like Google) and they are all "safe" in the opposite ways of PB.


freak wrote:
The zero initialization has been part of the language from the very beginning. And as we pointed out its costs are minimal. So it is not going to change.

So you are of the "we have always done it this way so we cannot change" mindset? How disappointing for the future of PB. Especially with a simple update that can easily be 100% backward compatible. Does your attitude carry over to ALL speed optimizations?


Top
 Profile  
 
 Post subject: Re: simple speed optimization request
PostPosted: Wed Jan 18, 2012 11:10 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Aug 27, 2011 9:50 pm
Posts: 107
Location: Washington, USA
Tenaja wrote:
Java is no longer interpreted... and its speed is not matched by anything except C, on a Linux benchmark. In fact, it has a very small penalty, according to this benchmark:
http://shootout.alioth.debian.org/u64q/ ... &lang2=gcc
Maybe somebody has the "free time" to see how PB stacks up.

Well, let's see, C, Java, C++, GO!, these are all "modern," in the sense that they are heavily used in "modern times" (or backed by a big organization like Google) and they are all "safe" in the opposite ways of PB.


The point freak was making is that java does the same thing PB does regarding variable initialization, and as you pointed out clearly isn't suffering for it since it's currently one of the fastest runtime environments around.

Tenaja wrote:
So you are of the "we have always done it this way so we cannot change" mindset? How disappointing for the future of PB. Especially with a simple update that can easily be 100% backward compatible. Does your attitude carry over to ALL speed optimizations?


This isn't a simple update. It may possibly be 'simple' from a programming standpoint, but it is far from simple from a support standpoint. This feature will cause more people to shoot themselves in the foot than it will help, and there's already a mechanism to get what you want: assembly.


Top
 Profile  
 
 Post subject: Re: simple speed optimization request
PostPosted: Wed Jan 18, 2012 11:16 pm 
Offline
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 5:21 pm
Posts: 5188
Location: Germany
Tenaja wrote:
freak wrote:
> Oddly, PB has them exactly opposite of every "modern" programming language...except maybe some interpreted junk.

You mean such junk as Java?


Java is no longer interpreted... and its speed is not matched by anything except C, on a Linux benchmark. In fact, it has a very small penalty, according to this benchmark:
http://shootout.alioth.debian.org/u64q/ ... &lang2=gcc
Maybe somebody has the "free time" to see how PB stacks up.

Well, let's see, C, Java, C++, GO!, these are all "modern," in the sense that they are heavily used in "modern times" (or backed by a big organization like Google) and they are all "safe" in the opposite ways of PB.


I mentioned Java because it has automatic 0-initialization for class member variables (see the link). Btw, the 'junk' part was sarcasm.


Tenaja wrote:
freak wrote:
The zero initialization has been part of the language from the very beginning. And as we pointed out its costs are minimal. So it is not going to change.

So you are of the "we have always done it this way so we cannot change" mindset? How disappointing for the future of PB. Especially with a simple update that can easily be 100% backward compatible. Does your attitude carry over to ALL speed optimizations?


I am not going to dignify that with a response.

_________________
Perl – The only language that looks the same before and after RSA encryption.
-- Keith Bostic


Top
 Profile  
 
 Post subject: Re: simple speed optimization request
PostPosted: Thu Jan 19, 2012 7:43 am 
Offline
Addict
Addict

Joined: Sun Aug 08, 2004 5:21 am
Posts: 1088
Location: Netherlands
@Tenaja, I'm curious about your recursive functions.
You say your project has over 80 of those that are called very often.
Maybe you could share a simple one and get feedback on how others think the speed could be optimized.


Top
 Profile  
 
 Post subject: Re: simple speed optimization request
PostPosted: Thu Jan 19, 2012 10:01 am 
Offline
Enthusiast
Enthusiast

Joined: Sat Dec 20, 2003 6:19 pm
Posts: 467
Location: Switzerland
freak wrote:
[..]
I mentioned Java because it has automatic 0-initialization for class member variables (see the link). Btw, the 'junk' part was sarcasm.
[..]

Ok, I misunderstood.

But you surely didn't miss this part:
Quote:
A local variable (§14.4, §14.13) must be explicitly given a value before it is used, by either initialization (§14.4) or assignment (§15.26), in a way that can be verified by the compiler using the rules for definite assignment (§16).

And you know that there are well thought-out
reasons for Java to initialize instance fields to 0?
  • Of course random values would be worse
  • Allow for evolution of serialized classes (by adding fields): http://docs.oracle.com/javase/6/docs/pl ... rsion.html
  • There is no way to check if a field gets initialized before use in a modular way, which is a requirement for Java
None of these reasons exist for PB except the first,
which is moot for local variables because the third
reason is not valid.

_________________
Athlon64 3700+, 1024MB Ram, Radeon X1600


Top
 Profile  
 
 Post subject: Re: simple speed optimization request
PostPosted: Thu Jan 19, 2012 10:30 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 8:26 am
Posts: 1290
@Tenaja:
It is time for you to try C++, C# and Java. You can't request optimizations for PB as you may see
in this topic. Try Intel C++, it's 500% of PureBasic features including parallel programming and everything
modern coders care for. PB is like QBASIC and it wants to stay like Win95 17 years ago.
freak does not care about modern programming, he likes old-style BASIC and gets lost in writing
old-style PureBasic-Tools like the Purifier and other stuff instead more modern stuff and optimizations.

The people here suggest to use ASM, i recommend to switch to C++/C#/Java instead - if you want to develop
big projects and not want to stay with the basics of computer programming for the next 20 years.


Top
 Profile  
 
 Post subject: Re: simple speed optimization request
PostPosted: Thu Jan 19, 2012 11:06 pm 
Offline
Addict
Addict

Joined: Tue May 06, 2003 5:07 pm
Posts: 2258
Location: UK
I'm very happy of the non-Win95 looking applications I have made so far thanks to Purebasic, this optimisation request is not optimisation, it just means longer code / more time.
Even if I'm a bit fustrated the PB Mac is not improving fast enough (especially for very simple things like the scrollbar gadget), I'm very happy of Purebasic overall :)


Top
 Profile  
 
 Post subject: Re: simple speed optimization request
PostPosted: Thu Jan 19, 2012 11:18 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 8:26 am
Posts: 1290
Polo wrote:
this optimisation request is not optimisation, it just means longer code / more time

You know nothing about optimizations. A simple
Code:
Procedure abc(xyz)
    a = 12
EndProcedure
is initialized double in PB and that's the point. For BASIC coders this might be OK,
but not for Pros.


Top
 Profile  
 
 Post subject: Re: simple speed optimization request
PostPosted: Thu Jan 19, 2012 11:39 pm 
Offline
Addict
Addict

Joined: Tue May 06, 2003 5:07 pm
Posts: 2258
Location: UK
Danilo wrote:
Polo wrote:
this optimisation request is not optimisation, it just means longer code / more time

You know nothing about optimizations.

If you say so. What matters to me is how fast my app is, and my PB apps are usually faster than any C++/whatever coded app.


Top
 Profile  
 
 Post subject: Re: simple speed optimization request
PostPosted: Fri Jan 20, 2012 2:43 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Jan 21, 2011 8:25 am
Posts: 549
Polo wrote:
and my PB apps are usually faster than any C++/whatever coded app.

No freaking way. That's just a hype that held itself for ages. :wink:
Sure you can write efficient PB code by going low-level...but that's not what high level programming languages are created for. :wink:

_________________
Image
ImageImageImage
"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


Top
 Profile  
 
 Post subject: Re: simple speed optimization request
PostPosted: Fri Jan 20, 2012 8:33 am 
Offline
Addict
Addict

Joined: Sun Aug 08, 2004 5:21 am
Posts: 1088
Location: Netherlands
Danilo wrote:
The people here suggest to use ASM, i recommend to switch to C++/C#/Java instead - if you want to develop
big projects and not want to stay with the basics of computer programming for the next 20 years.

Why switch ? There's no reason to stick to one language.
Basic is a great language to learn about programming. And there's not only such a thing as execution speed, there's also the time involved to create something.
My experience with C (Objective-C in this case) is that you can do a lot more with it but when it comes to simple projects, it takes longer to create something compared to a language like PureBasic.


Top
 Profile  
 
 Post subject: Re: simple speed optimization request
PostPosted: Fri Jan 20, 2012 2:21 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 8876
Location: France
Danilo wrote:
@Tenaja:
It is time for you to try C++, C# and Java. You can't request optimizations for PB as you may see
in this topic. Try Intel C++, it's 500% of PureBasic features including parallel programming and everything
modern coders care for. PB is like QBASIC and it wants to stay like Win95 17 years ago.
freak does not care about modern programming, he likes old-style BASIC and gets lost in writing
old-style PureBasic-Tools like the Purifier and other stuff instead more modern stuff and optimizations.

The people here suggest to use ASM, i recommend to switch to C++/C#/Java instead - if you want to develop
big projects and not want to stay with the basics of computer programming for the next 20 years.


Please calm down, there is no need to get overly aggressiv over freak or PureBasic. I decide of the PureBasic concept, and I don't want of a 'so called' modern programming language because it doesn't fit with beginners. For now, PureBasic is fast, even very fast for any kind of applications. It compiles to raw assembly code, so there is indeed room for optimisation, but it's very good in general. All the PureBasic commands are compiled with mainstream C compilers with all optimisations activated, so every PB coder benefits of that. And most of the time is spend in PB functions. So micro optimisations like these, which makes only differences on specific benchmarks, are meaningless for me. I do prefer spend my time on other more useful things like new commands or improving the compiler. PB isn't here to compete with C/C++ compilers which are developped by dozen of peoples who only concentrate on optimizing the code output. Now, if you are not happy with it, it's your choice, but please respect PureBasic and the team, thank you.

BTW, I did wrote the purifier, and even your lovely C/C++ doesn't have it build in. You need costly tools like Purify, MemoryValidator to detect easily a memory overflow. That's a kind of tool which can save you days of debugging, so yes, this is very important to me. Ha, it's free with PureBasic.


Top
 Profile  
 
 Post subject: Re: simple speed optimization request
PostPosted: Fri Jan 20, 2012 2:48 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Dec 20, 2003 6:19 pm
Posts: 467
Location: Switzerland
Fred wrote:
[..]PB isn't here to compete with C/C++ compilers which are developped by dozen of peoples who only concentrate on optimizing the code output. Now, if you are not happy with it, it's your choice, but please respect PureBasic and the team, thank you.

BTW, I did wrote the purifier, and even your lovely C/C++ doesn't have it build in. You need costly tools like Purify, MemoryValidator to detect easily a memory overflow. That's a kind of tool which can save you days of debugging, so yes, this is very important to me. Ha, it's free with PureBasic.

Indeed you are working on this alone. May I give some
suggestions of how you could change that?
  • Implement a plug-in interface like the one you wanted to add years ago (to allow external optimizers). E.g. give us access to your IR after parsing. That would allow us to add many interesting features.
  • Provide your parser of the PB language as a library, so we would not need to write our own (which will never be 100% the same as you do not provide a language specification for PB). With this we could do many more source-level tools like for example refactoring tools.
  • Use platform standards like adding debug-info to executables in a standardized format. E.g. allow us to use GDB or Valgrind (which is free btw.) to debug our programs
All in all make the compiler modular.
Then again I don't really use PB anymore and could not
guarantee that I'd really write such plug-ins as contributing
to the PB community is really only a hobby of mine.

_________________
Athlon64 3700+, 1024MB Ram, Radeon X1600


Top
 Profile  
 
 Post subject: Re: simple speed optimization request
PostPosted: Fri Jan 20, 2012 3:03 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 8876
Location: France
That's some good ideas, i will look at it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 61 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye