Raised This Month: $51 Target: $400
 12% 

compare


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 03-25-2022 , 02:05   compare
Reply With Quote #1

could someone help me with comparing?
1st function is very simple.
I want to know how much 2nd's CPU usage is greater than 1st's one. It's obviously much more but how much?

how does arrays look like:
Spoiler

1st

2nd

2nd (shortened, without debug messages)

they both utilize this function
__________________
Now working on: Side Weapons (Very lazy, tbh)
Avatar source: https://bit.ly/3BAk19g
Discord: kww#9951

Last edited by kww; 03-25-2022 at 02:18.
kww is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 03-25-2022 , 04:30   Re: compare
Reply With Quote #2

This is not an answer to your question but I see you're doing something wrong while create the loop

PHP Code:
// The loop should not start from zero because it is an unkown number make 'i = 1' or remove '=' 
pickSiteByIndex(selected)
{
    for(new 
i<= g_iMaxPossibleIndexByEnti++)
    {
        if(
!= selected)
        {
            
removeSiteByIndex(ifalse)
        }
    }

__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-25-2022 , 07:24   Re: compare
Reply With Quote #3

Quote:
Originally Posted by Supremache View Post
This is not an answer to your question but I see you're doing something wrong while create the loop

PHP Code:
// The loop should not start from zero because it is an unkown number make 'i = 1' or remove '=' 
pickSiteByIndex(selected)
{
    for(new 
i<= g_iMaxPossibleIndexByEnti++)
    {
        if(
!= selected)
        {
            
removeSiteByIndex(ifalse)
        }
    }

No its not, first item index in an array is zero, zero is always the first id of a cell. ( Memory address + index )

Now for an answer for the TOPIC, its very obvious the first method is the best for the least CPU usage.

Also show the function where you increment this variable g_iMaxPossibleIndexByEnt
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 03-25-2022 at 07:27.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 03-25-2022 , 08:06   Re: compare
Reply With Quote #4

Quote:
Originally Posted by Natsheh View Post
No its not, first item index in an array is zero, zero is always the first id of a cell. ( Memory address + index )

Now for an answer for the TOPIC, its very obvious the first method is the best for the least CPU usage.

Also show the function where you increment this variable g_iMaxPossibleIndexByEnt
I know the first cell id is zero but i mean another thing when i back i will give you some examples
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 03-25-2022 , 08:28   Re: compare
Reply With Quote #5

Why to not use ArraySortEx / ArraySort

Edit: Do you mean to compare the functions by CPU usage?
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]

Last edited by Shadows Adi; 03-25-2022 at 08:30.
Shadows Adi is offline
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 03-25-2022 , 21:50   Re: compare
Reply With Quote #6

Quote:
Originally Posted by Natsheh View Post
Now for an answer for the TOPIC, its very obvious the first method is the best for the least CPU usage.
2nd method should be used if map designed like a ... (please, check the picture under 2nd spoiler)

Quote:
Originally Posted by Natsheh View Post
Also show the function where you increment this variable g_iMaxPossibleIndexByEnt
sure

if you have a question: why do u create another one stupid trie?


Quote:
Originally Posted by Shadows Adi View Post
Why to not use ArraySortEx / ArraySort
Hmm... I don't see where I can use it. Could you show me?

Quote:
Originally Posted by Shadows Adi View Post
Edit: Do you mean to compare the functions by CPU usage?
Yes, because I can't do it myself (maybe too selfish, sorry)
__________________
Now working on: Side Weapons (Very lazy, tbh)
Avatar source: https://bit.ly/3BAk19g
Discord: kww#9951

Last edited by kww; 03-25-2022 at 22:33.
kww is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 03-26-2022 , 02:22   Re: compare
Reply With Quote #7

Try this. It is a custom stock for ArrayFindString func, because it has some problems.
See this: https://forums.alliedmods.net/showthread.php?t=329651
Code:
pickSiteByName(const szSelectedName[]) {     new szDictRetrievedName[MAX_SITENAME_LENGTH]     new szArrayRetrievedName[MAX_SITENAME_LENGTH]     new iIndex     // loop thru all dictionary entries     for(new i; i <= g_iMaxPossibleIndexByName; i++)     {         // retrieve name from dictionary by index         ArrayGetString(g_BSnameDict, i, szDictRetrievedName, charsmax(szDictRetrievedName))                 iIndex = ArrayFindStringEx(g_BSname, g_iMaxPossibleIndexByEnt, szSelectedName, szArrayRetrievedName, charsmax(szArrayRetrievedName))         if(iIndex != -1)         {             removeSiteByIndex(iIndex, true)             break         }     } } stock ArrayFindStringEx(Array:which, maxLoop, const item[], storeString[], lenght) {     for(new i; i < maxLoop; i++)     {         ArrayGetString(which, i, storeString, lenght)         if(containi(storeString, item))         {             return i         }     }     return -1 }
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode