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

A performance discussion.


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Author Message
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 12-09-2005 , 06:05   A performance discussion.
#1

Hey all.

I was just browsing mattie.info, and I cant help but notice the amount of people creating scripts...
Am I the only one who sees a problem with using scripts instead of plugins ?
I mean, your telling the CS game engine to load a file on every single player shot in most of the scripts, not even a plugin, the game engine itself ffs.
Then, ontop of that, your making it call functions in plugins from the scripts, over and over again, instead of just changing a variable or two here and there.
And, not even one function, you end up having something like...
es_function1 es_function2( es_function3( es_function4 ) );

I havent installed any of them, nor would I, but I am very very surprised server admins actually dont mind the performance decrease I am conjuring ?
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
BAILOPAN
Join Date: Jan 2004
Old 12-09-2005 , 06:16  
#2

Unless scripting is packed into bytecode it's not worth even considering the performance implications - it'll be as slow as possible.
__________________
egg
BAILOPAN is offline
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 12-09-2005 , 07:37  
#3

So why in gods name do all of these server admins bother ??
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
cybermind
Senior Member
Join Date: Oct 2004
Old 12-09-2005 , 12:46  
#4

Because some of those scripts do stuff that isn't available in other plugins just yet. Not to say it isn't possible, as it obviously is, it's just not been done.
cybermind is offline
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 12-09-2005 , 12:54  
#5

With the amount of useless cvars and function names people have to remember, learning C++ would be easier.
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
ichthys
Veteran Member
Join Date: Dec 2004
Location: []*[]
Old 12-09-2005 , 14:36  
#6

If you've seen what eventscripts started as you would never expect it to do the things it can do now. I agree with you that I would never have script packs such as warcraft and superheros on a server of my own. (well firstly they havent been done very well). But there are simpler es script packs that have their uses and dont require for such common events to fire .cfgs
__________________
ichthys is offline
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 12-10-2005 , 08:37  
#7

Anything other than round_end, round_start and other events where no playing is happening are fine, but ANYTHING in a player_hurt, player_death or any other in game events are pretty intensive..
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
Mattie
Veteran Member
Join Date: Jan 2005
Old 12-10-2005 , 14:21   Re: A performance discussion.
#8

Quote:
Originally Posted by c0ldfyr3
Hey all.

I was just browsing mattie.info, and I cant help but notice the amount of people creating scripts...
Am I the only one who sees a problem with using scripts instead of plugins ?
Nah, but coders worry about this more than admins do. We just don't think about it the right way. Performance is both (a) not as important as we would think and (b) not affected as much by these scripts as we think.

Do plugins perform faster than scripts? Obviously-- by leaps and bounds! But the question is not "which is faster". Instead, for the vast majority of people the question is:
  • Do I get the functionality I want and still get the performance I need?
This is a lot like arguing against a higher-level language. Think about it this way: is Java worthless because it performs slower than C++? What about VBScript? JScript? PHP?

No-- they all have their usefulness. Yet if you're doing something mission critical that needs every millisecond, you're going to stick with ASM or C/C++. The number of cases where this is necessary is far fewer. Otherwise every website in the world would code their dynamic pages in C-- yet here we are conversing over a scripting-language-enabled website.

Even full plugins are necessarily slower performing than a server without them. Yet people still add those, too. It's just a trade-off, and you trade-off what you can afford.

And you don't even know what performance issues might be there-- why don't you try it? It's very easy to configure. That's a common recommendation in coding: generally, it's best not to jump through hoops optimizing performance until it affects you. If it doesn't perform well enough for your needs, optimize the bottlenecks.

And you'd be surprised, anyway. If the performance was so bad, EventScripts never would have gotten popular. For example, I have a large number of scripts (including player_hurt spam) on my beta test Windows CS:S server. It's not the best performing server, but it plays well enough to have regular players-- and it's running on an old AMD Athlon 2000 which is also running, like, 15 web servers (including mattie.info, wikis, etc). My other beta test server is on nice hardware running at 66-tick. It supports far more scripts and generally has very solid performance.

In the end, a few scripts don't matter for performance for the average players. It really doesn't impact things as much as you think.

As to why there are so many of these scripts being created, that's pretty clear. The whole point for EventScripts is not for coding full-fledged plugins, but to let people customize their servers easily. Why in the world does someone need to know C++, how to build on Windows and Linux, virtual function hooking, and the Source SDK just to customize their server? Why must an admin have no option just because it doesn't perform as well as if he learned C++ and coded it from scratch or with metamod help?

Some people use it for more advanced things-- and more power to them. On powerful servers, even heavily scripted gameplay can be fine. I would never recommend people do that for anything too serious. As ichthys says, I can't imagine I'd play competively on a server that was heavily modded with scripts. Yet for a fun mod (we're talking about games here, afterall), a little extra reduction in responsiveness spread equally around is just fine.

Scripts are popular because it is far, far, far easier to create a cfg file that works across platforms than it is to write a plugin to do so. Zillions of admins with some knowledge of computers vs. perhaps a hundred or so coders who would be interested in writing plugins.

Let's breakdown the performance weaknesses compared to a plugin:
  • Valve command console/queue handling
  • Script interpreting (conditions/variable expansion/etc)
  • Console commands parsing
  • exec file access
#1 runs inside the server-- this can affect performance because the command queue can only be consumed at a particular point in the GameFrame. I don't feel that this substantially affects anyone on a level that players would notice. Small hit, really.

#2 costs a bit more, but this is all handled inside a server plugin which we're already assuming is pretty fast. This is the general cost associated with a higher-level scripting language. I.e., the interpreting overhead costs something. This is the 2nd biggest hit, but is a welcome trade-off for having cross-platform support without understanding C++/pointers/etc. There are different ways to optimize your scripts such that the biggest performance bottlenecks minimize the interpretation impact (e.g. only making a few passes through the variable expansion engine, etc).

#3 isn't actually an issue since these commands are basically taking advantage of the code inside other server plugins or the server itself. These are very light and can commonly map closely to what you'd do in the Source SDK anyway in a function. There's some overhead in parsing the params/etc, but it's below the cost of #2 so it's not very troublesome.

#4 is where the real bottleneck appears. Loading a cfg file from disk every time an event fires? Wow-- that sounds like it could be expensive. Yet, it turns out to be very acceptable. Because of this issue, I never assumed that ES would see a lot of heavy scripting. Yet, with good OS file system caching and fast disk speeds, it's a little less than you'd expect.

The last, being the bottleneck, is where we work first. And people on Linux servers have already begun to map their entire event cfg directories onto a RAM drive to nearly negate this cost. And now they're running complex scripts on 64-slot high-tick servers!

The next version of EventScripts will have experimental support for changing exec to memory cache the cfg file and use that if the on-disk file hasn't changed. As such, we'll see this bottleneck reduced even farther and you'll see that in the common case performance doesn't even register as affected.

At any rate, I completely understand where you're coming from, because I wouldn't have expected EventScripts to get so much use. Yet, this is one of those situations where you just have to try it to see where it performs poorly for you. If it does, you write a plugin. If it doesn't affect things enough to warrant all the trouble, well congrats, you spent 5 minutes writing your own customization rather than investing in an entire plugin.

One last point I'll make is that I get far more requests to add commands to EventScripts than I get to increase the performance. In my mind, that's the real test of how well it's performing for people.

Give ES a shot-- I'd love to hear your thoughts on its performance. I'm constantly working on ways to thin the lines between plugins and scripts, but obviously it'll never be perfect. I'm aiming for acceptable. ;)

-Mattie
Mattie is offline
cybermind
Senior Member
Join Date: Oct 2004
Old 12-10-2005 , 15:04   Re: A performance discussion.
#9

Quote:
Originally Posted by Mattie
As to why there are so many of these scripts being created, that's pretty clear. The whole point for EventScripts is not for coding full-fledged plugins, but to let people customize their servers easily. Why in the world does someone need to know C++, how to build on Windows and Linux, virtual function hooking, and the Source SDK just to customize their server? Why must an admin have no option just because it doesn't perform as well as if he learned C++ and coded it from scratch or with metamod help?
This exact thing was the reason AdminMod, and then AMXMod, and then AMXModX plugins became so popular. Until a system like that (using Pawn/AMX or some other language) comes around (even after), people will be very content with EventScripts as it is easy to work with.
cybermind is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 12-10-2005 , 15:04  
#10

tl;dr
Freecode is offline
Closed Thread



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 17:50.


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