TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Neil Heller
from: Pascal Schmidt
date: 2004-05-19 12:45:40
subject: A question

Hi Neil! :-)

 NH> I don't know of a 32-bit real system.  By "real" I take
it that you 
 NH> mean a system using segments and offsets.  I'll bet the paging system
 NH> in memory looks forward to flexing its muscles with that.  Whatever, I 
 NH> think that it's time I try it out for myself.
What I meant was that you need to initialize all that memory for the hash
table and also the full table will never fit into the CPU's cache, meaning
you'll have lots of real memory accesses, which are slow.

For one of my projects, I did a rgb2yuv colorspace conversion routine in
two variants. One used a full lookup table (256MB), the other a smaller 8KB
table and some fixed-point int additions and shifts. The variant with the
8KB table turned out to be faster because the whole table did fit into the
CPU L1 cache and stayed there because it was only occupying 1/8th of the
cache and accessed frequently. The variant with the large table had almost
no computations in it, but the memory accesses were killing performance.

What I'm saying is that sometimes an algorithm that looks faster on paper
turns out to suck in practise.

 PS>> The most primitive algorithm for this problem 
 PS>> (compare each with each) would be O(n^2).
 NH> Yipes, I hope it doesn't come to that.
That one is very memory efficient, though, and good enough for smaller
input sets. Think about using your approach for 64 bit integers, how much
memory would your hash table consume?

Ciao
Pascal

--- Msged/LNX 6.1.1
* Origin: let fun a b c d = b (c,d) in a op < 17 end 23 (1:153/401.2)
SEEN-BY: 633/267 270
@PATH: 153/401 307 140/1 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.