It basically boils down to a basic speed versus extensibility tradeoff.
From: [email protected] To: [email protected] Subject: RE: [agi] Namespace search optimization Date: Thu, 1 Jan 2015 08:55:44 -0800 Given 200-250 base functions in 10 packages (namespaces), if the functions are defined as language intrinsics (like if or for) then there is no need for pakckage lookup, no need to resolve the name with the namespace, so no overheard is incurred. If the functions are defined as qualified identifiers (prefixed by package name) then we need to look up any unqualified identifiers first, thereby resolving the identifier with the package, before proceeding with the evaluation. For Example, the set function in the System.KB package (namespace) sets a slot in a prototype instance to a value. The programmer can fully qualify the function call (System.KB.set ?identifier ?slot ?value) Or the programmer can reference the package and use an unqualified call (require System.KB) (set ?identifier ?slot ?value) When set is encountered we need to search the required namespaces to determinewhich set function is implied, hence we find System.KB.set and replace set withthe fully qualified name. We do this during form evaluation in the REPL,whetherthe REPL is just-in-time compiled or interpreted. If we defined set as an intrinsic then there would be no package issue, but also no modularity. We just encounter set and call the set intrinsic. So there is no overheadincurred by attempting to resolve the function name with a namespace. So, my question is, are there any known optimizations to this problem of resolving function names with packages? ~PM From: [email protected] To: [email protected] Subject: RE: [agi] Namespace search optimization Date: Thu, 1 Jan 2015 09:03:05 +0000 Dictionary lookups (on the first part of the name if the full list is big compared to RAM)? From: Piaget Modeler via AGI [[email protected]] Sent: 01 January 2015 05:53 To: AGI Subject: [agi] Namespace search optimization Are there any optimizations that can be done to look up identifiers in namespaces for either just in time compilers or interpreters ? I'm writing a REPL and namespace resolution of function identifiers takes too much time away from overall evaluation. Any ideas or thoughts? ~PM AGI | Archives | Modify Your Subscription UNIVERSITY OF CAPE TOWN This e-mail is subject to the UCT ICT policies and e-mail disclaimer published on our website at http://www.uct.ac.za/about/policies/emaildisclaimer/ or obtainable from +27 21 650 9111. This e-mail is intended only for the person(s) to whom it is addressed. If the e-mail has reached you in error, please notify the author. If you are not the intended recipient of the e-mail you may not use, disclose, copy, redirect or print the content. If this e-mail is not related to the business of UCT it is sent by the sender in the sender's individual capacity. AGI | Archives | Modify Your Subscription AGI | Archives | Modify Your Subscription ------------------------------------------- AGI Archives: https://www.listbox.com/member/archive/303/=now RSS Feed: https://www.listbox.com/member/archive/rss/303/21088071-f452e424 Modify Your Subscription: https://www.listbox.com/member/?member_id=21088071&id_secret=21088071-58d57657 Powered by Listbox: http://www.listbox.com
