in reply to Re^2: defining methods on the fly
in thread defining methods on the fly
Yes, the cache is rebuilt. You're just resetting it. All new method lookups after it's been reset are cached until it's reset again. Here's some code I ran in bleadperl which includes a function to look at the version number of the method lookup cache. Things that you do once during setup aren't usually of any account. It's worth blowing your cache then because you get all the utility of whatever it is that you stopped to do and you don't usually incur lots of extra runtime work. When you blow your cache during your run you impact your overall performance because now you're penalizing all the time consuming regular stuff too.
use B 'sub_generation'; sub show_cache_version { print sub_generation, "\n" } show_cache_version; # 554 { show_cache_version; # 554 local *call = sub { }; show_cache_version; # 555 <- @ISA cache reset } show_cache_version; # 555
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: defining methods on the fly
by jdhedden (Deacon) on Aug 03, 2006 at 19:14 UTC | |
by flogic (Acolyte) on Aug 03, 2006 at 20:24 UTC | |
by revdiablo (Prior) on Aug 04, 2006 at 17:37 UTC | |
by jdhedden (Deacon) on Aug 05, 2006 at 01:57 UTC |