[PLUG] Cache usage and integer computation speed
Eric Wilhelm
scratchcomputing at gmail.com
Wed Nov 23 00:27:05 UTC 2005
# from Rogan Creswick
# on Tuesday 22 November 2005 03:00 pm:
>FWIW, your table could at least be a multiple of getpagesize() bytes
>(4096 on my system).
>
>* Eventually isn't it likely that even local (stack) variables will
>end up in cache, and cause portions of your table to be relegated bace
>to standard memory? Presumeably you won't be accessing every value in
>the table more than anything else.. or will you?
Correct me if I'm wrong, but isn't "which pages are in the CPU cache"
determined by the kernel based on access frequency? (and maybe some
other interesting parameters)
If so, it would probably be a good idea to just use a (custom-ordered by
frequency of use?) hash with buckets based on the pagesize (seems like
there should be a lib for that.) Yeah, you'll end up in main memory
with some of the buckets, but if that performance hit is worse than
just recalculating from nothing, then I have to doubt whether caching
will actually give you real-world performance gains.
--Eric
--
But you can never get 3n from n, ever, and if you think you can, please
email me the stock ticker of your company so I can short it.
--Joel Spolsky
---------------------------------------------------
http://scratchcomputing.com
---------------------------------------------------
More information about the PLUG
mailing list