Frequency of use of functions

Everything else that doesn't fall into one of the other PB categories.
AZJIO
Addict
Addict
Posts: 2191
Joined: Sun May 14, 2017 1:48 am

Frequency of use of functions

Post by AZJIO »

I did a search for functions in projects using a regular expression

Code: Select all

\b[A-Za-z_]\w*\h*(?=\()
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.
User avatar
jacdelad
Addict
Addict
Posts: 2010
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: Frequency of use of functions

Post by jacdelad »

And?
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Quin
Addict
Addict
Posts: 1133
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: Frequency of use of functions

Post 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?
User avatar
skywalk
Addict
Addict
Posts: 4218
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Frequency of use of functions

Post 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.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
AZJIO
Addict
Addict
Posts: 2191
Joined: Sun May 14, 2017 1:48 am

Re: Frequency of use of functions

Post 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.
AZJIO
Addict
Addict
Posts: 2191
Joined: Sun May 14, 2017 1:48 am

Re: Frequency of use of functions

Post 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.
User avatar
skywalk
Addict
Addict
Posts: 4218
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Frequency of use of functions

Post 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.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
STARGÅTE
Addict
Addict
Posts: 2232
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Frequency of use of functions

Post 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.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
AZJIO
Addict
Addict
Posts: 2191
Joined: Sun May 14, 2017 1:48 am

Re: Frequency of use of functions

Post 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.
User avatar
skywalk
Addict
Addict
Posts: 4218
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Frequency of use of functions

Post by skywalk »

Of course you have to confirm absolute timing with a profiler, but this is an interesting way to pareto your code.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
STARGÅTE
Addict
Addict
Posts: 2232
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Frequency of use of functions

Post 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.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
Quin
Addict
Addict
Posts: 1133
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: Frequency of use of functions

Post 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 :cry:
AZJIO
Addict
Addict
Posts: 2191
Joined: Sun May 14, 2017 1:48 am

Re: Frequency of use of functions

Post 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.
User avatar
skywalk
Addict
Addict
Posts: 4218
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Frequency of use of functions

Post by skywalk »

You could modify your search to lookup a known list of functions. Ignore comments.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Post Reply