[4.61] ValF() sloooooooower than in 4.51 on Wine

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Niffo
Enthusiast
Enthusiast
Posts: 504
Joined: Tue Jan 31, 2006 9:43 am
Location: France

[4.61] ValF() sloooooooower than in 4.51 on Wine

Post by Niffo »

The code below takes about 10 seconds to execute on PB 4.61 on my machine and about 10 miliseconds on PB 4.51 !
ValF() is about 1000 times slower than in PB 4.51

Code: Select all

t = ElapsedMilliseconds()
For i = 1 To 10000
   a = ValF("1.5")
Next i
Debug ElapsedMilliseconds() - t
Last edited by Niffo on Sun May 27, 2012 6:30 am, edited 2 times in total.
Niffo
gekkonier
User
User
Posts: 78
Joined: Mon Apr 23, 2007 9:42 am

Re: [4.61] ValF() sloooooooower than in 4.51

Post by gekkonier »

debug on/off?
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: [4.61] ValF() sloooooooower than in 4.51

Post by ts-soft »

The speed of the debugger is useless!

Code: Select all

t = ElapsedMilliseconds()
For i = 1 To 10000
   a = ValF("1.5")
Next i
MessageRequester("", Str(ElapsedMilliseconds() - t))
No difference!

Greetings - Thomas
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

Re: [4.61] ValF() sloooooooower than in 4.51

Post by MachineCode »

Niffo wrote:The code below takes about 10 seconds to execute on PB 4.61 on my machine
Only takes 15 ms on my old XP PC with 4.61 installed. Try a fresh install of PureBasic 4.61 in a new folder and test again.
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [4.61] ValF() sloooooooower than in 4.51

Post by Fred »

No problem here
Niffo
Enthusiast
Enthusiast
Posts: 504
Joined: Tue Jan 31, 2006 9:43 am
Location: France

Re: [4.61] ValF() sloooooooower than in 4.51

Post by Niffo »

Hum ... ok ... i used to use PB on Wine (on Linux) and this difference seems to only exist on Wine and not on a real Windows :(
This is a real problem for me because one of my big project massively use ValF() and i want to continue to Use PB on Wine.
I suppose it can not be considered as a bug since it is not visible on a real Windows.
But there must be a difference in the code of the ValF() fonction between PB4.51 and PB4.61 that cause Wine to react differently.
Niffo
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [4.61] ValF() sloooooooower than in 4.51

Post by Fred »

We now always set the locale:

Code: Select all

  #ifdef WINDOWS
    setlocale(LC_NUMERIC, "English"); 
  #endif
because of this bug: http://www.purebasic.fr/english/viewtop ... 4&start=30

Wine has probably a slow way to do it, but that's mainly a Wine problem. I will try to see if getting the locale, compare it and only change it if necessary is faster.
Niffo
Enthusiast
Enthusiast
Posts: 504
Joined: Tue Jan 31, 2006 9:43 am
Location: France

Re: [4.61] ValF() sloooooooower than in 4.51

Post by Niffo »

Thank you 1000 times ! :)
Niffo
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: [4.61] ValF() sloooooooower than in 4.51

Post by blueznl »

Fred wrote:We now always set the locale:

Code: Select all

  #ifdef WINDOWS
    setlocale(LC_NUMERIC, "English"); 
  #endif
because of this bug: http://www.purebasic.fr/english/viewtop ... 4&start=30

Wine has probably a slow way to do it, but that's mainly a Wine problem. I will try to see if getting the locale, compare it and only change it if necessary is faster.
You are not authorised to read this forum.
Don't refer to something if people can't read it :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
PMV
Enthusiast
Enthusiast
Posts: 727
Joined: Sat Feb 24, 2007 3:15 pm
Location: Germany

Re: [4.61] ValF() sloooooooower than in 4.51 on Wine

Post by PMV »

It was readable when he wrote that. :wink:
After releases fixed bugs are always moved.
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: [4.61] ValF() sloooooooower than in 4.51 on Wine

Post by c4s »

It was a bug I reported. Under certain circumstances ValF() did not detect "2.3" as a float anymore. The problem was that when opening e.g. OpenFileRequester() other system applications (namely an anti-virus tool but possibly others as well) changed the local setting again - That's probably what PureBasic did as well when our application started.
Anyway, after opening the file requester only "2,3" was detected...
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
Niffo
Enthusiast
Enthusiast
Posts: 504
Joined: Tue Jan 31, 2006 9:43 am
Location: France

Re: [4.61] ValF() sloooooooower than in 4.51 on Wine

Post by Niffo »

For information, there is the same "problem" with PB 5.00
Niffo
Post Reply