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

Solved loop entitys


Post New Thread Reply   
 
Thread Tools Display Modes
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 11-17-2022 , 21:35   Re: loop entitys
Reply With Quote #51

Quote:
Originally Posted by fysiks View Post
The mistakes I made didn't negate my original suggestion so no, they did not affect my original suggestion.

Also, as stated before, there are other reasons to do things than just to be a few nanoseconds more efficient.
If you first say that the size of the array is defined when it is compiled, everything below that you say is wrong, and I could continue enumerating, and yes, imagine that this operation is done by 32 players, you always have to put yourself in the worst case, to have a real difference

Last edited by MrPickles; 11-17-2022 at 21:36.
MrPickles is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-17-2022 , 21:37   Re: loop entitys
Reply With Quote #52

Quote:
Originally Posted by MrPickles View Post
If you first say that the size of the array is defined when it is compiled, everything below that you say is wrong, and I could continue enumerating, and yes, imagine that this operation is done by 32 players, you always have to put yourself in the worst case, to have a real difference
Arrays cannot change size at runtime. That is a fact. I even explained other benefits to my suggestion so even if one of my reasons happened to be wrong, that doesn't make the other reasons wrong.

How long are we going to do this?
__________________
fysiks is offline
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 11-17-2022 , 21:41   Re: loop entitys
Reply With Quote #53

Quote:
Originally Posted by fysiks View Post
Arrays cannot change size at runtime. That is a fact. I even explained other benefits to my suggestion so even if one of my reasons happened to be wrong, that doesn't make the other reasons wrong.

How long are we going to do this?
no, an array with defined cell size will not change, what if it is the array with cell size that you put to that function, and that function, will have to calculate the maximum size of that placed array, that's why everything that Saying down is wrong, because it's not what we're talking about, I think I said it, see if you can reread it, and when you want to stop, I could be counter-arguing your mistakes all day long.

https://forums.alliedmods.net/showpo...4&postcount=33
MrPickles is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-17-2022 , 21:45   Re: loop entitys
Reply With Quote #54

Quote:
Originally Posted by MrPickles View Post
no, an array with defined cell size will not change, what if it is the array with cell size that you put to that function, and that function, will have to calculate the maximum size of that placed array, that's why everything that Saying down is wrong, because it's not what we're talking about, I think I said it, see if you can reread it, and when you want to stop, I could be counter-arguing your mistakes all day long.

https://forums.alliedmods.net/showpo...4&postcount=33
You're blinded by your obsession with over optimization.

You're welcome to just say "I'll do it how I want because I'm the only one who will use the code". That is a good enough answer.
__________________

Last edited by fysiks; 11-17-2022 at 21:45.
fysiks is offline
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 11-17-2022 , 21:59   Re: loop entitys
Reply With Quote #55

Quote:
Originally Posted by fysiks View Post
You're blinded by your obsession with over optimization.

You're welcome to just say "I'll do it how I want because I'm the only one who will use the code". That is a good enough answer.
mm I didn't exactly say that, but I would say something like this:

"If I can do it more optimally than anyone else, even if only I understand it, go ahead."

Last edited by MrPickles; 11-17-2022 at 21:59.
MrPickles is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-17-2022 , 22:01   Re: loop entitys
Reply With Quote #56

Quote:
Originally Posted by MrPickles View Post
mm I didn't exactly say that, but I would say something like this:

"If I can do it more optimally than anyone else, even if only I understand it, go ahead."
"optimal" is subjective to the context. Optimal to code maintenance and code readability are different from execution efficiency.
__________________
fysiks is offline
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 11-17-2022 , 22:03   Re: loop entitys
Reply With Quote #57

Quote:
Originally Posted by fysiks View Post
"optimal" is subjective to the context. Optimal to code maintenance and code readability are different from execution efficiency.
Did you know that the word "optimum" in the dictionary does not mean "code maintenance and code readability"? optimal and efficient is the reading, execution, compile time, etc., which is what I do
MrPickles is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-17-2022 , 22:12   Re: loop entitys
Reply With Quote #58

Quote:
Originally Posted by MrPickles View Post
Did you know that the word "optimum" in the dictionary does not mean "code maintenance and code readability"? optimal and efficient is the reading, execution, compile time, etc., which is what I do
Quote:
optimum
ŏp′tə-məm
noun

- The point at which the condition, degree, or amount of something is the most favorable.
It's not specific to any one thing. Just about anything can have an "optimum".
__________________
fysiks is offline
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 11-17-2022 , 22:18   Re: loop entitys
Reply With Quote #59

Quote:
Originally Posted by fysiks View Post
It's not specific to any one thing. Just about anything can have an "optimum".
Well, in this case, the optimal/effective is reading, compile time, response time, number of players using this plugin, if that makes the code understandable only by me, then go ahead.

feel free to stop writing, i can do this all day

Last edited by MrPickles; 11-17-2022 at 22:25.
MrPickles is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-17-2022 , 22:49   Re: loop entitys
Reply With Quote #60

Ok, so I think I have something that supports my assertion that the size of the array is determined at compile time for my method of having the sizeof as the default value of the second argument.

Here is my plugin:

PHP Code:
#include <amxmodx>

public plugin_init( ) 
{
    
myFunction({1,3,5})
    
myFunction({1})
    
myFunction({2,34,334,30,340,34,0})
    
myFunction({2,34,334,30,340,34,0,334,30,340,34,0,334,30,340,34,0})
}

stock myFunction(myArray[], len sizeof myArray)
{
    
#pragma unused myArray
    
server_print("Array Size: %d"len)

If I decompile the plugin_init() function I get this:

Code:
0x8                        PROC              ; public plugin_init()
0xC                       BREAK 
0x10                      BREAK 
0x14                     PUSH.C  0x3        
0x1C                     PUSH.C  0x14       
0x24                     PUSH.C  0x8        
0x2C                       CALL  0xA8        ; stock myFunction(myArray[],len)
0x34                      BREAK 
0x38                     PUSH.C  0x1        
0x40                     PUSH.C  0x20       
0x48                     PUSH.C  0x8        
0x50                       CALL  0xA8        ; stock myFunction(myArray[],len)
0x58                      BREAK 
0x5C                     PUSH.C  0x7        
0x64                     PUSH.C  0x24       
0x6C                     PUSH.C  0x8        
0x74                       CALL  0xA8        ; stock myFunction(myArray[],len)
0x7C                      BREAK 
0x80                     PUSH.C  0x11       
0x88                     PUSH.C  0x40       
0x90                     PUSH.C  0x8        
0x98                       CALL  0xA8        ; stock myFunction(myArray[],len)
0xA0                   ZERO.pri 
0xA4                       RETN
As you can see, the first PUSH.C for each function call is the size of the array passed into the function without having to actually pass that value in the function call. This proves that the size of the array is determined at compile time, not at runtime.

If this doesn't resolve your issue with me saying that the size of the array is determine at compile time then you were arguing about something that I didn't assert.
__________________
fysiks 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 04:25.


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