octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: symbol table changes for private functions, classes, etc.


From: John W. Eaton
Subject: Re: symbol table changes for private functions, classes, etc.
Date: Sat, 12 May 2007 01:58:40 -0400

On 12-May-2007, David Bateman wrote:

| What might concern me with this idea is that it will potentially impact
| the speed of Octave. The symbols that are out of scope when doing a
| symbol lookup aren't useful for lookups in the current scope, but being
| in the same map affect the speed of the lookup. I suppose std::map uses
| a hash so perhaps this won't be so bad. In any case a few benchmarks of
| complex examples are probably in order before and after the change

I think there is a good chance it will be faster, but you are right
that it depends on how fast lookups are in the std::map class.  OTOH, the
previous code was horrible, especially for accessing variables, so I'm
betting the performance of std::map doesn't have to be too amazing for
it to be faster anyway.  Currently, even accessing a variable just to
get its value requires several function calls and some crazy logic.
Now I think it will just require one function call and two map
lookups.  The current sitiuation for accessing variables for
assignment is even worse, and the new code should again only require a
function call and two map lookups.  So I don't see how it can be
slower, but I've surprised myself before.

Also, I think the first lookup by name can now be done just once when
the tree_identifier object corresponding to the symbol in the parse
tree is created, then it is really just one std::map lookup to get a
value.  Since the scope ID is just an integer, I think the map lookup
should be fast, but I'm not sure what method is used (and I guess that
could be implementation dependent).

| Also, do you see this change going into 3.0?

I don't think so.  How about 3.1?

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]