Giter Club home page Giter Club logo

Comments (12)

Sophist-UK avatar Sophist-UK commented on June 24, 2024

Might be.

from dlfilter.

Sophist-UK avatar Sophist-UK commented on June 24, 2024

AFAIK, hash tables enable you to look up the value against a key quickly for large numbers of keys. I believe that you can iterate over the hash table too, though that is not their purpose.

I am unsure how we can use a hash table for fast lookup of iswm matching - we can use it as an array and iterate the values in order to get the values to iswm with, but that is unlikely to be any faster then the long list of if iswm.

But if there is a way to use a hash table effectively let me know and I will code it.

from dlfilter.

Sophist-UK avatar Sophist-UK commented on June 24, 2024

Hmmm - it seems that $hfind(hashtable, message, 1, W) uses the hash table item or data as wildcard text - so perhaps this is possible.

from dlfilter.

SanderSade avatar SanderSade commented on June 24, 2024

Good find, I didn't know about that $hfind() option. My initial idea was just looping over hashmap/items, to make filters more easier to maintain, compared to endless if statements.

The hashmap should also contain the appropriate method to call on match, e.g.:
filter <--> method
*SpR JUKEBOX*filesize* TextSetNickColor
*DCC GET COMPLETE*from*slot*open* DLF_textfilter

from dlfilter.

Sophist-UK avatar Sophist-UK commented on June 24, 2024

Yes - we will need different hash tables for each group.

I have this mostly done on my PC (but not yet on GitHub) - when I do the next commit it would be helpful if you could deskcheck old and new code to make sure that I have create a like for like solution.

from dlfilter.

Sophist-UK avatar Sophist-UK commented on June 24, 2024

$hfind will be at least one order of magnitude more efficient/faster (and possibly two orders of magnitude) than a loop or list of if statements.

from dlfilter.

SanderSade avatar SanderSade commented on June 24, 2024

It really depends.

Hash map should be O(1), if Khaled has implemented it properly. However, since that $hfind() is a wildcard match on key, it probably loops internally and is O(n).

from dlfilter.

Sophist-UK avatar Sophist-UK commented on June 24, 2024

Yes - but it will be machine code (C?) rather than interpreted mIRC script.

from dlfilter.

SanderSade avatar SanderSade commented on June 24, 2024

I presume that mIRC compiles the script internally to bytecode/assembly-like on load and uses that. But you are probably right.

We can always do a performance test if we really care...

from dlfilter.

Sophist-UK avatar Sophist-UK commented on June 24, 2024

I don't really care TBH. It was performing OK on my PC as a list of IF statements.

But I think using hashtables is both more elegant and more maintainable.

from dlfilter.

SanderSade avatar SanderSade commented on June 24, 2024

Exactly. The if's just tickle my inner perfectionist in the wrong way.

from dlfilter.

Sophist-UK avatar Sophist-UK commented on June 24, 2024

Coded - see #7

from dlfilter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.