Ticket #302 (new defect)

Opened 13 years ago

define/memo doesn't save time for funs of arity > 1

Reported by: clements@… Owned by: dherman
Priority: major Milestone:
Component: dherman/memoize.plt Keywords:
Cc: Version: (3 1)
Racket Version: 5.0.1.7

Description

It appears that define/memo is missing all of the time for functions of more than one argument. Here's a version of fib that takes 2 (identical) arguments:

#lang racket

(require (planet dherman/memoize))

(define/memo (fib n1 n2)

(if (<= n2 1) 1 (+ (fib (- n1 1) (- n2 1)) (fib (- n1 2) (- n2 2)))))

(time (fib 28 28))

This program runs faster without memoization; it appears that the cache check always misses.

Note: See TracTickets for help on using tickets.