|
Bugzilla – Full Text Bug Listing |
| Summary: | Could use an API to "stash" the Python wrapper for an object | ||
|---|---|---|---|
| Product: | ns-3 | Reporter: | Gustavo J. A. M. Carneiro <gjcarneiro> |
| Component: | core | Assignee: | ns-bugs <ns-bugs> |
| Status: | RESOLVED INVALID | ||
| Severity: | enhancement | ||
| Priority: | P3 | ||
| Version: | pre-release | ||
| Hardware: | All | ||
| OS: | All | ||
|
Description
Gustavo J. A. M. Carneiro
2008-08-19 13:24:42 UTC
The pybindgen feature was added: http://bazaar.launchpad.net/~gjc/pybindgen/trunk/revision/563?start_revid=563 At the moment it uses a std::map<void*, PyObject*>, with O(log(N)) lookup time (about 16 lookups for 100000 objects). It probably isn't awful performance, considering typical Python scripts do not usually manipulate that many objects. But of course O(1) lookup would be even better... ;-) (In reply to comment #1) > The pybindgen feature was added: > > http://bazaar.launchpad.net/~gjc/pybindgen/trunk/revision/563?start_revid=563 > > At the moment it uses a std::map<void*, PyObject*>, with O(log(N)) lookup time > (about 16 lookups for 100000 objects). It probably isn't awful performance, > considering typical Python scripts do not usually manipulate that many objects. > > But of course O(1) lookup would be even better... ;-) What you could conceivably do is automatically aggregate to each object another object which contains the pointer back to the python object. (In reply to comment #2) > (In reply to comment #1) [...] > > But of course O(1) lookup would be even better... ;-) > > What you could conceivably do is automatically aggregate to each object another > object which contains the pointer back to the python object. Great idea! Ashamed it didn't occur to me... :P |