Page 1 of 1
Frequency of use of functions
Posted: Tue Feb 25, 2025 1:07 am
by AZJIO
I did a search for functions in projects using a regular expression
I received a list of 117,000 functions. Then, using my counting program, I got the top functions.
Code: Select all
5650 Str
4163 Chr
2273 ImageID
2067 MessageRequester
1964 Asc
1957 SetGadgetText
1785 Len
1680 MenuItem
1661 AddElement
1650 FileSize
1630 Left
1531 AddGadgetItem
1364 ScintillaSendMessage
1362 Val
1246 ReadPreferenceString
1236 GetPathPart
1220 ReplaceString
1160 GetGadgetText
1158 ResizeGadget
1117 GetGadgetState
1019 RGB
1007 WindowID
982 ProgramFilename
969 FindString
933 Box
913 Mid
879 ListSize
877 SizeOf
871 RunProgram
860 StartDrawing
818 PeekS
810 OpenWindow
787 ReadPreferenceInteger
737 SetGadgetState
730 GadgetToolTip
688 Random
679 ButtonGadget
659 WaitWindowEvent
642 SendMessage_
640 GetFilePart
617 Hex
602 CatchImage
589 Right
570 OpenPreferences
558 TextGadget
545 SelectElement
Now I realize in which feature descriptions I need quality translation and examples.
Re: Frequency of use of functions
Posted: Tue Feb 25, 2025 2:30 pm
by jacdelad
And?
Re: Frequency of use of functions
Posted: Tue Feb 25, 2025 2:41 pm
by Quin
Yeah, I share the confusion, very little info was given here. Even, what projects these are. Sources from the forum? Your projects? Sources found on government computers?
Re: Frequency of use of functions
Posted: Tue Feb 25, 2025 2:53 pm
by skywalk
That is really cool and would be more revealing if we knew the source data?
Are these only your projects?
Makes sense with only 5000 str() calls.
It may mean a fast string lib would improve your timing.
Re: Frequency of use of functions
Posted: Tue Feb 25, 2025 2:55 pm
by AZJIO
jacdelad wrote: Tue Feb 25, 2025 2:30 pmAnd?
The key word is in the last line. We have 3,000 functions in the reference file. There is a desire to improve the translation and examples. But 90% of the features I don't use. So decided to get the top features that I use. And further put the effort in that direction.
Re: Frequency of use of functions
Posted: Tue Feb 25, 2025 3:02 pm
by AZJIO
skywalk wrote: Tue Feb 25, 2025 2:53 pm
It may mean a fast string lib would improve your timing.
I used my program to test regular expressions and I waited 11 minutes for 117,000 lines. I had to rewrite using CopyMemoryString(), the speed increased, it started to run 1 sec. 1 second versus 11 minutes.
But that's a diversion from the topic.
Re: Frequency of use of functions
Posted: Tue Feb 25, 2025 3:11 pm
by skywalk
Yes, the native string lib is only useful for casual use. Populating arrays are fast.
The other top functions are GUI and string related.
Interesting, never thought to pareto my function calls.
Re: Frequency of use of functions
Posted: Tue Feb 25, 2025 3:15 pm
by STARGÅTE
Counting the occurrence of function names in the source code is not equal to the runtime call frequency, because of loops, recursive calls, etc.
To me, such a list is meaningless.
Re: Frequency of use of functions
Posted: Tue Feb 25, 2025 3:26 pm
by AZJIO
STARGÅTE wrote: Tue Feb 25, 2025 3:15 pm
To me, such a list is meaningless.
This is individual for everyone. For those who write 3D games, the list will be different. If a module of 10,000 lines is among the files, then it will make errors with its functions. It is important for me not the number of calls in real time, but the amount of use in the code. For each function, I have to read the description in the help file, and these pages should be qualitatively translated into my native language.
Re: Frequency of use of functions
Posted: Tue Feb 25, 2025 3:33 pm
by skywalk
Of course you have to confirm absolute timing with a profiler, but this is an interesting way to pareto your code.
Re: Frequency of use of functions
Posted: Tue Feb 25, 2025 3:43 pm
by STARGÅTE
What I wonder is, why StartDrawing() is with 860 occurrences on place 30, but I can't see StopDrawing(), although these two commands must be used almost equally often.
Re: Frequency of use of functions
Posted: Tue Feb 25, 2025 3:44 pm
by Quin
skywalk wrote: Tue Feb 25, 2025 3:11 pm
Yes, the native string lib is only useful for casual use. Populating arrays are fast.
This is the exact reason I wish for a faster string manager and/or native built-in StringBuilder. This sadly won't happen for a while if ever though, Fred called it too time consuming

Re: Frequency of use of functions
Posted: Tue Feb 25, 2025 4:30 pm
by AZJIO
STARGÅTE wrote: Tue Feb 25, 2025 3:43 pm
What I wonder is, why StartDrawing() is with 860 occurrences on place 30, but I can't see StopDrawing(), although these two commands must be used almost equally often.
Because I copied the results, which may have 3 functions in a row, and it was duplicated.
Code: Select all
If CreateImage(0, 200, 200) And StartDrawing(ImageOutput(0))
I copied the text from the search results, but I needed to write a special utility.
Re: Frequency of use of functions
Posted: Tue Feb 25, 2025 4:46 pm
by skywalk
You could modify your search to lookup a known list of functions. Ignore comments.