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

Set Stock or Bool


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 10-06-2022 , 21:32   Set Stock or Bool
Reply With Quote #1

What is better in this case?

Option 1:

PHP Code:

public SpawnEffectsid )
{
         
CreateExplosionid );
         
CreateWaveid );
}
stock CreateExplosionid )
{
        
// Effect
}
stock CreateWaveid )
{
        
// Effect

or Option 2:

PHP Code:
public SpawnEffectsid )
{
         
CreateExplosionidtrue );
}
stock CreateExplosionidbool:Wave )
{
        
// Effect

       
if(Wave)
       {
            
// Create Wave
       
}

what is faster?

Last edited by MrPickles; 10-06-2022 at 21:32.
MrPickles is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 10-06-2022 , 22:12   Re: Set Stock or Bool
Reply With Quote #2

doesnt matter thats just sick to think off
__________________
bigdaddy424 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-07-2022 , 00:05   Re: Set Stock or Bool
Reply With Quote #3

  1. Those two codes don't do the same thing.
  2. You're overthinking things way too much with respect to execution speed for trivial code. Just write code that works. If it become a problem (unlikely) then you can optimize later.
__________________

Last edited by fysiks; 10-07-2022 at 00:18.
fysiks is offline
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 10-07-2022 , 00:14   Re: Set Stock or Bool
Reply With Quote #4

Quote:
what is faster?
mm I think the example and the question were extremely clear and basic, it was only to answer either option 1 or option 2
, neither of the 2 has answered what I asked, they only gave an opinion, but not a 3-word answer

Quote:
[*]Those two codes don't do the same thing.
and yes, they do, in both, a wave and an explosion are created, only the call of 1 stock is saved, in addition to leaving an option for it

Last edited by MrPickles; 10-07-2022 at 00:20.
MrPickles is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-07-2022 , 00:19   Re: Set Stock or Bool
Reply With Quote #5

There will not be any significant difference.
__________________
fysiks is offline
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 10-07-2022 , 00:22   Re: Set Stock or Bool
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
There will not be any significant difference.
That it is not significant does not mean that there is a difference, there is, that is why I asked which one is faster, I do not understand what is the reason for evading the answer, one could say, "the difference is not significant but the 2 is faster" , that is all
MrPickles is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-07-2022 , 00:34   Re: Set Stock or Bool
Reply With Quote #7

Quote:
Originally Posted by MrPickles View Post
That it is not significant does not mean that there is a difference, there is, that is why I asked which one is faster, I do not understand what is the reason for evading the answer, one could say, "the difference is not significant but the 2 is faster" , that is all
There is absolutely no reason to care which is faster (because the difference is negligible) on even a semi-modern computer. If you're interested to know the difference between two versions of code, you may be interested in learning how to profile code yourself. There are some threads on it.

You're certainly free to dislike the answer and you can wait for another answer also.
__________________
fysiks is offline
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 10-07-2022 , 01:09   Re: Set Stock or Bool
Reply With Quote #8

Quote:
You're certainly free to dislike the answer and you can wait for another answer also.
Yes, I received a much more effective and faster response:

Quote:
the difference is not significant but the 2 is faster
thanks for nothing

Last edited by MrPickles; 10-07-2022 at 01:10.
MrPickles is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-07-2022 , 01:45   Re: Set Stock or Bool
Reply With Quote #9

Quote:
Originally Posted by MrPickles View Post
thanks for nothing
I gave you a valid response that even you have seen from other people here.
__________________

Last edited by fysiks; 10-07-2022 at 01:46.
fysiks is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-07-2022 , 07:52   Re: Set Stock or Bool
Reply With Quote #10

Use the first method, because it's more unique and flexible, if you wanted to use/call each function by itself
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 06:30.


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