Improving lookup performance for Hashtables

  • 4 Replies
  • 3596 Views
*

frankinstien

  • Replicant
  • ********
  • 653
    • Knowledgeable Machines
Improving lookup performance for Hashtables
« on: July 25, 2021, 03:03:37 am »
I read a few articles about hashtables and the problem with collisions. So I came up with a key algorithm using power functions to create unique keys from strings using only alphanumeric characters. So by precomputing the keys as doubles I get a lookup improvement of anywhere from 43% to 90%!

Below are some tests where the dictionary has 370,102 unique words and 100,000 lookups were performed for each test:

Code
Performce Test with NET string key dictionary

Total Time for all look ups: 0.04 seconds!

__________________________________
Performce Test with NET double key dictionary

Total Time for all look ups: 0.029 seconds!

__________________________________
Performce Test with NET string key dictionary

Total Time for all look ups: 0.053 seconds!

__________________________________
Performce Test with NET double key dictionary

Total Time for all look ups: 0.028 seconds!

__________________________________
Performce Test with NET string key dictionary

Total Time for all look ups: 0.041 seconds!

__________________________________
Performce Test with NET double key dictionary

Total Time for all look ups: 0.028 seconds!

Ultimately the key generator will be modified to work with numerical ranges so fuzzy states can be looked up using a hashtable.

*

MagnusWootton

  • Replicant
  • ********
  • 646
Re: Improving lookup performance for Hashtables
« Reply #1 on: July 25, 2021, 03:15:16 am »
Dont understand,  are u getting a lookup speed increase?    and its just looking for an exact match or is it looking for a similarity match?

Ive got an optimization for nearest neighbour matching myself,   but I dont understand what  "precomputing the keys as doubles"  means!   why wouldnt an integer suffice - why need floating point unit?

*

frankinstien

  • Replicant
  • ********
  • 653
    • Knowledgeable Machines
Re: Improving lookup performance for Hashtables
« Reply #2 on: July 25, 2021, 03:25:45 am »
Right now it's an exact match but I just tried using byte arrays and I'm getting a 408% improvement over just using string keys! :D

Of course, there are data sources for partial matches or usual entry mistakes and this approach will shine with those kinds of resources.

*

frankinstien

  • Replicant
  • ********
  • 653
    • Knowledgeable Machines
Re: Improving lookup performance for Hashtables
« Reply #3 on: July 25, 2021, 11:02:21 pm »
Oops, that claim about byte arrays was due to an error in the code! But the use of the power function key(double) performance boost is consistent. O0

*

MagnusWootton

  • Replicant
  • ********
  • 646
Re: Improving lookup performance for Hashtables
« Reply #4 on: July 26, 2021, 04:25:39 am »
Ai requires a really excellent optimization,  if it turns out your unlucky this time,   you've only failed once you've given up completely.

If you want to know about my KNN op,  just ask,   unless u want your own original invention, which I highly recommend over copying others!  :)
« Last Edit: July 26, 2021, 05:30:37 am by MagnusWootton »

 


Requirements for functional equivalence to conscious processing?
by DaltonG (General AI Discussion)
November 19, 2024, 11:56:05 am
Will LLMs ever learn what is ... is?
by HS (Future of AI)
November 10, 2024, 06:28:10 pm
Who's the AI?
by frankinstien (Future of AI)
November 04, 2024, 05:45:05 am
Project Acuitas
by WriterOfMinds (General Project Discussion)
October 27, 2024, 09:17:10 pm
Ai improving AI
by infurl (AI Programming)
October 19, 2024, 03:43:29 am
Atronach's Eye
by WriterOfMinds (Home Made Robots)
October 13, 2024, 09:52:42 pm
Running local AI models
by spydaz (AI Programming)
October 07, 2024, 09:00:53 am
Hi IM BAA---AAACK!!
by MagnusWootton (Home Made Robots)
September 16, 2024, 09:49:10 pm
LLaMA2 Meta's chatbot released
by spydaz (AI News )
August 24, 2024, 02:58:36 pm
ollama and llama3
by spydaz (AI News )
August 24, 2024, 02:55:13 pm
AI controlled F-16, for real!
by frankinstien (AI News )
June 15, 2024, 05:40:28 am
Open AI GPT-4o - audio, vision, text combined reasoning
by MikeB (AI News )
May 14, 2024, 05:46:48 am
OpenAI Speech-to-Speech Reasoning Demo
by MikeB (AI News )
March 31, 2024, 01:00:53 pm
Say good-bye to GPUs...
by MikeB (AI News )
March 23, 2024, 09:23:52 am
Google Bard report
by ivan.moony (AI News )
February 14, 2024, 04:42:23 pm
Elon Musk's xAI Grok Chatbot
by MikeB (AI News )
December 11, 2023, 06:26:33 am

Users Online

367 Guests, 0 Users

Most Online Today: 529. Most Online Ever: 2369 (November 21, 2020, 04:08:13 pm)

Articles