
Is there a way to get non-generic versions of the hash set functions?

You mean “like set-add
but without the overhead of generics”?

I’ve got a tight loop that spends most of its time in set functions (the loop calls just set remove, set count, and set first)

If so, then the best solution is to use a hash table

Got it

Ok, I’ll custom write something

I suspect a vector might be faster, but was hoping to get the speed for cheap

the hash table “implementation” is really easy

but calling set-first
and set-remove
repeatedly is probably the real problem

that is not going to be fast

That’s why I think vector is better

Sadly this one algorithm is 40% of run time so I kinda gotta actually go to town on it

I’m thinking a vector with entries that can be set to #f. Then count, first, and remove can all be done in a single pass

but just using hash or set iteration is going to be much much better

Iteration is faster than first?

I only call first if it’s guaranteed to have one entry

I’ll probably rewrite this because the overhead is pretty bad.

(Overhead is something like 20% of the 40%, maybe more if tail calls are hiding something)

By the way, what’s the fastest way to loop over a vector? Am I giving up speed if I use for instead of vector-for each?

what makes lisp so great?