Search found 513 matches

by Provoni
Mar 01, 2017 17:02
Forum: Sources, Examples, Tips and Tricks
Topic: On FreeBASIC's random number generators.
Replies: 35
Views: 9095

Re: On FreeBASIC's random number generators.

deltarho[1859], My program needs to call the rnd or cryptos function millions of times per second and I just figured out that the calling of the function itself seems to be causing the slowdown especially while multithreaded. I currently have set up a weak pseudo random generated from internal value...
by Provoni
Feb 28, 2017 14:58
Forum: Sources, Examples, Tips and Tricks
Topic: On FreeBASIC's random number generators.
Replies: 35
Views: 9095

Re: On FreeBASIC's random number generators.

Tyvm deltarho[1859] for your kickass implementation, it is working now.

In my program, speedwise it is on par with FreeBASIC's option 1, 2 and 4. The quality of the randomness does not seem to matter much for my program, so I'm looking for something that is even faster (if possible).
by Provoni
Feb 27, 2017 20:28
Forum: General
Topic: Applying functions for speed optimization
Replies: 15
Views: 3137

Re: Applying functions for speed optimization

I have set up a pseudo random in the following way and wonder if it is possible to optimize away the MOD operation.

Code: Select all

new_random=(integer_value1+integer_value2) MOD random_range
by Provoni
Feb 27, 2017 19:33
Forum: Sources, Examples, Tips and Tricks
Topic: On FreeBASIC's random number generators.
Replies: 35
Views: 9095

Re: On FreeBASIC's random number generators.

@Provoni If you do not need a fixed seed enviroment then give my A fast CPRNG a bash - you could see your timings down to about 55 seconds. Five posts from the end of that thread you will find CryptoRndBuffer.bas for inclusion in your source code. Use '#define Algo 1' as used in the post following ...
by Provoni
Feb 26, 2017 18:53
Forum: Sources, Examples, Tips and Tricks
Topic: On FreeBASIC's random number generators.
Replies: 35
Views: 9095

Re: On FreeBASIC's random number generators.

I've tested these random number generators using my substitution solver, a stochastic hill climber. Option 1: time in seconds: 163.95, average score: 23905.71 Option 2: time in seconds: 157.91, average score: 23860.62 Option 3: time in seconds: 176.69, average score: 23923.33 Option 4: time in secon...
by Provoni
Feb 21, 2017 9:56
Forum: General
Topic: Applying functions for speed optimization
Replies: 15
Views: 3137

Re: Applying functions for speed optimization

Thanks SARG.
by Provoni
Feb 17, 2017 10:01
Forum: General
Topic: Applying functions for speed optimization
Replies: 15
Views: 3137

Re: Applying functions for speed optimization

Thanks SARG for spotting that. I will not try to come up with an excuse. Here is the new code, it is already twice as fast now thanks to your keen observation. function m_fastbigrams(array()as integer,byval l as integer,byval s as integer)as integer dim as short i,score,id(s,s) for i=1 to l-1 s=arra...
by Provoni
Feb 16, 2017 20:25
Forum: General
Topic: Applying functions for speed optimization
Replies: 15
Views: 3137

Re: Applying function for speed optimization

Submitting another similar function (m_fastbigrams) for optimization. It needs to be rock solid as it is called many billions of times on unique arrays with different arguments. function m_fastbigrams(array()as integer,byval l as integer,byval s as integer)as integer dim as short i,score,id(1,s,s) f...
by Provoni
Feb 12, 2017 17:10
Forum: General
Topic: Applying functions for speed optimization
Replies: 15
Views: 3137

Re: Applying function for speed optimization

Thanks allot guys, this is a huge and very welcome speed increase. I will be able to apply the same principles to other parts of my program. Great stuff.
by Provoni
Feb 11, 2017 15:44
Forum: General
Topic: Applying functions for speed optimization
Replies: 15
Views: 3137

Applying functions for speed optimization

Hey all, I'm looking to further speed optimize my function "m_ngrams". Especially initializing and clearing of the arrays "gram" and "id" are slowing down the function I believe. Thanks function m_ngrams(array()as integer,byval l as integer)as integer dim as integer i,j...
by Provoni
Jan 10, 2017 8:29
Forum: Beginners
Topic: UTF-8 to number
Replies: 4
Views: 993

Re: UTF-8 to number

Thanks all, My program worked after I started using wstring and ASC can be used to do the lookups. It should be fine. russian.txt "00:24 - На Евровидение Донни попал с третьей попытки." screenres 800,600,32 dim as integer i,j,k dim s as wstring*1000 open "russian.txt" for input e...
by Provoni
Jan 09, 2017 10:14
Forum: Beginners
Topic: UTF-8 to number
Replies: 4
Views: 993

UTF-8 to number

Hey all, My program needs to find the numerical values associated to UTF-8 characters in the same way that ASC("?") would return 63. It does not need to display them. Here's my attempt which returns "00:24 - ?? ??????????? ????? ????? ? ??????? ???????." I realize it is because I...
by Provoni
Jan 08, 2017 9:38
Forum: Beginners
Topic: Windows GUI
Replies: 145
Views: 31987

Re: Windows GUI

Do you still need help Kazuma? I want to thank everyone that helped me in this thread and in the other threads over the years. And special thanks to Lothar for the GUI and the FreeBASIC developers for a crazy fast BASIC. Here's the program that came of this thread: https://drive.google.com/file/d/0B...
by Provoni
Nov 15, 2016 9:15
Forum: Beginners
Topic: Windows GUI
Replies: 145
Views: 31987

Re: Windows GUI

Thanks allot MrSwiss and MichaelW. The issue is resolved now.
by Provoni
Nov 13, 2016 10:03
Forum: Beginners
Topic: Windows GUI
Replies: 145
Views: 31987

Re: Windows GUI

There is another issue where the window is not being updated until the mouse is moved or another user action is taken. Does this perhaps have anything to do with the Windows message system and is there a way to send messages periodically?