mIRC Home    About    Download    Register    News    Help

Print Thread
4,096 length of item in hash table #235910 19/01/12 10:04 AM
Joined: Mar 2004
Posts: 526
HorseC Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: Mar 2004
Posts: 526
while this may seem long enough for most, there is a situation where this is NOT long enough.. While i can create multiple items, I am wondering why that limitation is used. (yes, hash tables do take up memory, but that is NOT an issue).

Thanks for any replies.


Help others! It makes the world a better place, Makes you feel good, and makes you Healthy!
Re: 4,096 length of item in hash table [Re: HorseC] #235916 19/01/12 02:07 PM
Joined: Jan 2004
Posts: 1,330
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,330
I see no such limit practically or in any documentation.

Code:
alias a {
  bset &b 5000 1
  hadd -mb table item &b
  echo -ag $hget(table,item,&c)
  echo -ag $bvar(&c,0)

  echo -ag -
  var %v = $+($str(0,4100),1)
  hadd -m table item2 %v
  echo -ag $hget(table,item2)
  
  hadd -m table %v 1
  echo -ag $hget(table,%v)
}

Re: 4,096 length of item in hash table [Re: HorseC] #235924 20/01/12 12:28 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
The limit is not in the hash tables themselves, it's in how long a /command (and arguments) line can be. The limit is ~4kb, which means hash tables are limited by association, not by design. This also means that the behaviour cannot change (not just for hash tables anyway), nor is it only an issue for hash tables. It affects all commands and is an inherent limitation in the language.

Note that this limit only applies to the buffer length of a command. You can still store as much data as you want inside of a bvar, and then store that bvar in a hash table.



- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: 4,096 length of item in hash table [Re: Loki12583] #235925 20/01/12 12:29 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
You didn't try hard enough:

Code:
var %v = $+($str(0,4200),1)
; you won't even get to this line
hadd -m table item2 %v
echo -ag $hget(table, item2)


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"