Raised This Month: $32 Target: $400
 8% 

What is more efficient?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 02-26-2019 , 08:40   What is more efficient?
Reply With Quote #1

Huge pile of code inside one plugin or huge pile of code separated in multiple plugins (they're still communicative thanks to natives)?
redivcram is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 02-27-2019 , 02:24   Re: What is more efficient?
Reply With Quote #2

If you tend to make modifications frequently to the code than seperate. It's easier to navigate.
__________________
Relaxing is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-27-2019 , 04:04   Re: What is more efficient?
Reply With Quote #3

What weighs more? A kilo of brick or a kilo of feathers?
Think about it for a second, why would that matter? The same code still has to be executed.

You should organize the code in a way that makes sense and makes it easy for you to maintain and update it. This has nothing to do with efficiency.
__________________

Last edited by HamletEagle; 02-27-2019 at 04:07.
HamletEagle is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 03-01-2019 , 11:19   Re: What is more efficient?
Reply With Quote #4

Quote:
Originally Posted by HamletEagle View Post
What weighs more? A kilo of brick or a kilo of feathers?
Think about it for a second, why would that matter? The same code still has to be executed.

You should organize the code in a way that makes sense and makes it easy for you to maintain and update it. This has nothing to do with efficiency.
I don't know how AMXX works so I had to ask. You never know. Until now lol. Ty for replies.
redivcram is offline
shadowcs1
Junior Member
Join Date: Jan 2017
Old 03-02-2019 , 06:57   Re: What is more efficient?
Reply With Quote #5

I want to reply to this question too.
As for amxx, did you questioned yourself for example why in base plugins there are includes? Because it's more eficiently . As example, you make a plugin of a timeclock. Then you make another plugin where the player needs to answer questions and you find that it needs the timeclock. What do you do? Do you rewrite the whole code or just use externally the timeclock you already made?

Sorry for my bad english
shadowcs1 is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 03-02-2019 , 11:42   Re: What is more efficient?
Reply With Quote #6

Quote:
Originally Posted by shadowcs1 View Post
I want to reply to this question too.
As for amxx, did you questioned yourself for example why in base plugins there are includes? Because it's more eficiently . As example, you make a plugin of a timeclock. Then you make another plugin where the player needs to answer questions and you find that it needs the timeclock. What do you do? Do you rewrite the whole code or just use externally the timeclock you already made?

Sorry for my bad english
Yes, Pawn being my first ever language just has me confusing a bit still running in by bloodsteam. lmao
Your English and expression is a lot better than mine.
redivcram is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-02-2019 , 13:44   Re: What is more efficient?
Reply With Quote #7

Quote:
Originally Posted by shadowcs1 View Post
I want to reply to this question too.
As for amxx, did you questioned yourself for example why in base plugins there are includes? Because it's more eficiently . As example, you make a plugin of a timeclock. Then you make another plugin where the player needs to answer questions and you find that it needs the timeclock. What do you do? Do you rewrite the whole code or just use externally the timeclock you already made?

Sorry for my bad english
It's not more efficient as in better running time. It's just a better structure for your code and good programming practice.
__________________
HamletEagle is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 03-02-2019 , 14:42   Re: What is more efficient?
Reply With Quote #8

Why nobody speaks about an functions queue (stack)?
If you hook players spawn in 5 plugins, AMXX has to do:
Quote:
- looping over all plugins? (not sure about this)
- call spawn callback in the plugin
- execute the code inside
- return value
for all 5 plugins.
If you have only 1 plugin, the movements above will run only one time.
There will be just more code in the one function.

Am I right?
__________________
My English is A0
E1_531G is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-02-2019 , 14:45   Re: What is more efficient?
Reply With Quote #9

Quote:
Originally Posted by E1_531G View Post
Why nobody speaks about an functions queue (stack)?
If you hook players spawn in 5 plugins, AMXX has to do:

for all 5 plugins.
If you have only 1 plugin, the movements above will run only one time.
There will be just more code in the one function.

Am I right?
It does not matter. Having clear and well structured code is way more important. If you just copy paste everything together you are only going to get a terrible mess that breaks at the smallest change.
__________________
HamletEagle is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 03-02-2019 , 15:35   Re: What is more efficient?
Reply With Quote #10

I would always structure everything in one plugin simply because Natives will create overhead that can be avoided. Organization can be handled in different ways. For example, a comment block to specify what section you are working on works the same as having the code in different files.
__________________
Spirit_12 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 23:37.


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