Jump to content

Recommended Posts

Posted (edited)

ConcurrentDictionary is similar to ConcurrentHashMap ? Cause atm you simply need a HashMap, as you simply use it to check, and that map is fed normally only once (and content never replaced, removed or edited anew).

 

You obviously didn't noticed that he creates and runs a new thread for handling and running a dumb client request (they may come as thousands per second on a decent server), so I guess optimization and efficieny is the least of his concerns for now at least, his just making things that should work no matter the cost.

Edited by xxdem
Posted

Threadhandling and concurrency and async tasks is handled differently in CLR than JVM so you cant compare it.

 

My thread will be disposed in milliseconds once its executed. If the call was synchronous i would have performance issues.

 

All of those thread will be handled by enqueue eventually if they need to.

Posted (edited)

You obviously didn't noticed that he creates and runs a new thread for handling and running a dumb client request (they may come as thousands per second on a decent server), so I guess optimization and efficieny is the least of his concerns for now at least, his just making things that should work no matter the cost.

 

Until I missed the point, the map is used as a static checker for packet opcode and class reference, nothing else.

 

It worked fine before. I don't see the use of replacement, except winning 200 lines (at best and only for GS) on a never edited class.

 

----

 

K then, if it's differently handled. I clearly doubt concurrent is better performance than a simple switch = new object though. It must perform similar anyway.

Edited by Tryskell
Posted

Until I missed the point, the map is used as a static checker for packet opcode and class reference, nothing else.

 

It worked fine before. I don't see the use of replacement, except winning 200 lines (at best and only for GS) on a never edited class.

 

----

 

K then, if it's differently handled. I clearly doubt concurrent is better performance than a simple switch = new object though. It must perform similar anyway.

Only time will tell. Forget the concurrent keyword. It is just there because i use a Synchronization attribute in the class .

Technically it could be a simple Dictionary and i will test it that way too as a simple dictionary upon population is almost 2 times faster.

Posted

You obviously didn't noticed that he creates and runs a new thread for handling and running a dumb client request (they may come as thousands per second on a decent server), so I guess optimization and efficieny is the least of his concerns for now at least, his just making things that should work no matter the cost.

Interestingly enough I debugged the threads and yeah they where disposed really fast but I removed them, see how it performs and add a queue if it is needed.

 

About the benchmarking it performs exactly the same (Apart of the initial Dictionary loading which happens on startup anyway) but it is just way more easy to maintain and debug (which is very important for a project that is still adding the packets).

I can add a packet in one line instead of 5 and stepping through the code it way better.

Posted

Interestingly enough I debugged the threads and yeah they where disposed really fast but I removed them, see how it performs and add a queue if it is needed.

 

About the benchmarking it performs exactly the same (Apart of the initial Dictionary loading which happens on startup anyway) but it is just way more easy to maintain and debug (which is very important for a project that is still adding the packets).

I can add a packet in one line instead of 5 and stepping through the code it way better.

 

Just make 2-8 Thread workers and add Client Requests on their Queues, these threads are supposed to sleep a given time and execute from the queue forever.

 

I can tell you many reasons why creating a new thread sucks for every client request one of them and most important from me is that the Player has direct access on your resources both soft and hard, whereas in a worker queue design he can't

Posted

Just make 2-8 Thread workers and add Client Requests on their Queues, these threads are supposed to sleep a given time and execute from the queue forever.

 

I can tell you many reasons why creating a new thread sucks for every client request one of them and most important from me is that the Player has direct access on your resources both soft and hard, whereas in a worker queue design he can't

Yeah Enqueue should be fine. Really glad i got rid of that ugly switch statement. Thanks for the recommendation.

Posted

Yeah Enqueue should be fine. Really glad i got rid of that ugly switch statement. Thanks for the recommendation.

 

the switch statement has nothing to do with that, it was ugly but supper fast. Your design has the overhead of searching every time for the class and then initiating its instance through reflection. I guess its 100x slower but for sure cleaner and the overhead impact is unnoticeable 

Posted

the switch statement has nothing to do with that, it was ugly but supper fast. Your design has the overhead of searching every time for the class and then initiating its instance through reflection. I guess its 100x slower but for sure cleaner and the overhead impact is unnoticeable 

It is as fast as checking a small HashMap for a key value which is technically the same as as switch of the same size.

Posted

It is as fast as checking a small HashMap for a key value which is technically the same as as switch of the same size.

 

Im not talking about the HashMap, HashMap is super fast O(1) in most cases, Im talking about Class.newInstance which most probably is done with reflection on the runtime, I doubt that EnterWorld.class.getConstructor().newInstance() is anything close to "new EnterWorld()" in terms of perfomance

Posted

Im not talking about the HashMap, HashMap is super fast O(1) in most cases, Im talking about Class.newInstance which most probably is done with reflection on the runtime, I doubt that EnterWorld.class.getConstructor().newInstance() is anything close to "new EnterWorld()" in terms of perfomance

It is indeed using reflection but it caches the action so once it's done then it acts the same as new EnterWorld(), because it uses System instead of Reflection to create the instances. But that means that every single packet would have to be created with reflection at least once.

Posted

bWxaYHh.png

 

After some benchmarking it seems that in heavy load (50kk iterations) Activator.CreateInstance is up to 4 times slower (can get higher).

I know that's nothing for l2 but i wanna get as much horsepower as possible so i will be replacing Activator with compiled lambda expressions.

  • 2 weeks later...
Posted

Added the basic implementation of a Plugin API.

 

Simply create a class library on .NET Framework 4.6, extend the Plugin class and override whichever method you want.

Then drop the dll in the plugins folder and thats it.

 

3segxli.png

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



  • Posts

    • Destroyer lvl 72 with items on sell. Items: - Tallum heavy set, - black ore set, - Halberd + Haste [Pole A], - Infernal master +4, - Saint spear clean.   Contact me for more details !  
    • p0w3rf1y was Nikita? also how do these things work, they take a base lets say acis or lucera version XXX and then they build up from that to whatever they have today themselves without further company from..again, lucera or acis for example?
    • - CHAPTER IV NEW START FROM 16.MAY.2026 - RATES Experience (EXP) 30x Skill Points (SP) 30x Adena 10x Drop for Spoil 10x General Drop 10x RaidBoss Drop 3x Manor 4x Quest Drop 2x Quest Reward 3x Fishing Drop 10x Vitality System 25x Clan Reputation Point 2x ENCHANTS Safe Enchant +3 Max. Enchant +16 Normal Scroll chance 70% Blessed Scroll chance 80% Max donation enchant is +8 Yogi event enchant rate is 35% -Olf Max Enchant +9 enchant rates: +1 to +3 100%, +4 65%, +5 65%, +6 60%, +7 60%, +8 50%, +9 45% Elemental Max. Level Level 7 Elemental Stone chance 55% Elemental Crystal chance 50% CONFIGURATION Buffs, Dances, Songs Duration 2 hours Buff Slots 28+4+12 Max. Clients per PC 2 / IP 4 Olympiads Max. Enchant +8 Premium Geodata and Pathnodes Sub-Class Max. Level 85 Offline Shop mode Auto Learn Skills Vitality System Champions System Wedding System Class Master AUTO EVENTS Team vs. Team Last Man Standing Treasure Hunt Korean Style Capture the Flag Lucky Creatures Protect the King Russian Roulette Fight For Throne Deathmatch Domination TvT VIP Advanced Zombies Treasure Hunt No-PvP Hunting Grounds Mass Domination Lucky Chests Mutant Battlefields Mini Events Rabbits Simon Says Summer Meleons Pirates Treasure Hitman - Bounty Hunters Medal Collector Boss Random Etc. RAIDS RESPAWN TIME Valakas 72 hours / 24 hours random spawn Antharas 72 hours / 8 hours random spawn Baium 48 hours / 2 hours random spawn Baylor 24 hours/ 12 hours random spawn Beleth 48 hour OTHER Special Goddess of Destruction and Heroic Cloaks Goddess of Destruction .dress me Armors PvP + Rank + RPC Reward system Daily Quests available in community board New Achievements system Tournament system 1vs1 + Daily Tournament Academy Search for newbies, with payment Party Matching with class filter and manage Register to Fortress Siege as single player Cancelled buffs will return in 60 seconds (disabled) Improved .acpon will use now: MP, CP, GCP, GHP. SOULS Maximum number of slots for Private Store is 50 The maximum level for subclass is up to level 85 Multiple commands with advanced options, see them in com board You can view a monster drop rate and list by using shift+click Olympiad - Heroes are formed every Saturday at 01:05 GMT+2 Advanced Community Board with lots of new features for perfect play Advanced NPC buffer with almost all skills and up to 4 schemes per character Special Quiz event every 5 hours with over 500 questions and good reward Custom special Raids with special drop, with A.I against bots All major raids drop Donation Coins and Divine S Scrolls Super T.Rex with better drop and starting premium pets Glittering Medals from all mobs to exchange for special items Reduced number of clan members to raise the clan level and less reputation required Clan / Alliance has a reduced penalty AutoFarm, Community Cleaner, Weapon Repair system, Player Info, Server Online Statistics And many more... http://l2viserion.com https://www.facebook.com/l2viserion
    • - CHAPTER IV NEW START FROM 16.MAY.2026 - RATES Experience (EXP) 30x Skill Points (SP) 30x Adena 10x Drop for Spoil 10x General Drop 10x RaidBoss Drop 3x Manor 4x Quest Drop 2x Quest Reward 3x Fishing Drop 10x Vitality System 25x Clan Reputation Point 2x ENCHANTS Safe Enchant +3 Max. Enchant +16 Normal Scroll chance 70% Blessed Scroll chance 80% Max donation enchant is +8 Yogi event enchant rate is 35% -Olf Max Enchant +9 enchant rates: +1 to +3 100%, +4 65%, +5 65%, +6 60%, +7 60%, +8 50%, +9 45% Elemental Max. Level Level 7 Elemental Stone chance 55% Elemental Crystal chance 50% CONFIGURATION Buffs, Dances, Songs Duration 2 hours Buff Slots 28+4+12 Max. Clients per PC 2 / IP 4 Olympiads Max. Enchant +8 Premium Geodata and Pathnodes Sub-Class Max. Level 85 Offline Shop mode Auto Learn Skills Vitality System Champions System Wedding System Class Master AUTO EVENTS Team vs. Team Last Man Standing Treasure Hunt Korean Style Capture the Flag Lucky Creatures Protect the King Russian Roulette Fight For Throne Deathmatch Domination TvT VIP Advanced Zombies Treasure Hunt No-PvP Hunting Grounds Mass Domination Lucky Chests Mutant Battlefields Mini Events Rabbits Simon Says Summer Meleons Pirates Treasure Hitman - Bounty Hunters Medal Collector Boss Random Etc. RAIDS RESPAWN TIME Valakas 72 hours / 24 hours random spawn Antharas 72 hours / 8 hours random spawn Baium 48 hours / 2 hours random spawn Baylor 24 hours/ 12 hours random spawn Beleth 48 hour OTHER Special Goddess of Destruction and Heroic Cloaks Goddess of Destruction .dress me Armors PvP + Rank + RPC Reward system Daily Quests available in community board New Achievements system Tournament system 1vs1 + Daily Tournament Academy Search for newbies, with payment Party Matching with class filter and manage Register to Fortress Siege as single player Cancelled buffs will return in 60 seconds (disabled) Improved .acpon will use now: MP, CP, GCP, GHP. SOULS Maximum number of slots for Private Store is 50 The maximum level for subclass is up to level 85 Multiple commands with advanced options, see them in com board You can view a monster drop rate and list by using shift+click Olympiad - Heroes are formed every Saturday at 01:05 GMT+2 Advanced Community Board with lots of new features for perfect play Advanced NPC buffer with almost all skills and up to 4 schemes per character Special Quiz event every 5 hours with over 500 questions and good reward Custom special Raids with special drop, with A.I against bots All major raids drop Donation Coins and Divine S Scrolls Super T.Rex with better drop and starting premium pets Glittering Medals from all mobs to exchange for special items Reduced number of clan members to raise the clan level and less reputation required Clan / Alliance has a reduced penalty AutoFarm, Community Cleaner, Weapon Repair system, Player Info, Server Online Statistics And many more... http://l2viserion.com https://www.facebook.com/l2viserion
    • TG Support: Buying Proxy | Channel: Buying Proxy Discord support: #buyingproxy | Server: Join the BuyingProxy Discord Server! Create your account for free here
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..