9:50:36pveHi! If I have a generic function "whitespacep" and compare it with another, "make-whitespace-predicate", which returns a function that recognizes whitespace, I get these results:
9:52:16no-defun-allowedThat is quite possible, yes.
9:52:18beachIt is always tricky to do performance analyses on such small functions.
9:52:56pveI'm mostly interested in whether make-whitespace-predicate "should" be faster
9:53:12pveI feel it should, since there is no dispatch involved
9:53:25no-defun-allowedwhitespacep would perform method dispatch every time it is called, whereas make-whitespace-predicate only performs dispatch once. For such a small function, the runtime of method dispatch might be comparable to the runtime of your method.
9:55:13no-defun-allowedbeach: Are you sure? I'm reading the opposite: test-1 invokes a generic function and takes 1.5 seconds, and test-2 does not and takes 0.6 seconds.
10:07:47pveis there a way to tell the compiler "I think I know what I'm doing, use only this whitespacep method and skip the dispatch"?
10:09:16flip214GET compares the INDICATOR via EQL, and that can't be changed, right? So if I did (SETF (GET 'sym '(text :de)) "foo") I can't use GET to retrieve but have to use SYMBOL-PLIST?!
10:09:28pveor is the make-foo-predicate approach better in a tight loop?
10:09:35flip214pve: don't have a GF, or perhaps a compiler macro
10:10:21flip214or mark the function as INLINE and have a TYPECASE in there (with identical code, perhaps) - some past ELS used that to have the "right" optimized version for each usage