What You’ll Learn
By the end of this guide, you’ll understand:- ✅ How to build indexes for fast searching in large datasets
- ✅ When to use indexes vs. direct traversal
- ✅ How to recognize and handle detached objects
- ✅ How to access nested Revit parameters efficiently
Prerequisites
Before starting this guide, you should:- Understand how to traverse and filter objects
- Be comfortable with Python data structures (dictionaries, sets)
- Have worked with real-world Speckle projects (1000+ objects)
This guide focuses on performance optimization and complex patterns for working with large
BIM datasets. These patterns are most useful when dealing with projects from connectors like
Revit, Rhino, or ArchiCAD.
How do I make searching faster with indexes?
Repeatedly traversing large object trees is slow. If you need to search for multiple categories or properties, traversing the entire tree each time becomes a performance bottleneck.Terminology Note: Examples use property names like “category”, “level”, etc. for illustration.
Real BIM data from connectors may structure these differently - Revit uses both direct properties
AND proxy collections (e.g.,
LevelProxy, CategoryProxy). See BIM Data
Patterns for connector-specific structures.When should I use indexes vs. direct traversal?
You need to decide whether to traverse directly or build an index first. The wrong choice can hurt performance. Use direct traversal when:- ✅ Single search on a dataset
- ✅ Small datasets (less than 100 objects)
- ✅ One-time operation
- ✅ Memory is very limited
- ✅ Multiple searches on the same dataset
- ✅ Large datasets (1000+ objects)
- ✅ Repeated lookups by the same property
- ✅ Performance is critical
How do I handle detached objects?
Some objects in Speckle are “detached” - stored separately and referenced by ID. You see properties like@displayValue instead of the actual object.
Understand when and why detachment happens:
How do I access Revit parameters efficiently?
Revit objects have complex nested parameter structures organized by category. Accessing them efficiently requires understanding this structure. Access parameters via the properties dictionary:Practical Examples
Example 1: Complete Analysis Pipeline
Example 2: Export to DataFrame
Learn More
Core Concepts:- Data Traversal - Traversal fundamentals
- Objects & Base Class - Deep dive into object system
- BIM Data Patterns - Advanced BIM patterns
- Intermediate: Finding and Extracting Data - Traversal and filtering
- Operations - Send/receive operations
- Transports - Data transport layer
Summary
You’ve now learned:- ✅ Build indexes for O(1) lookups instead of O(n) traversals
- ✅ Choose wisely between direct traversal and indexing
- ✅ Handle detached objects and understand when they occur
- ✅ Access Revit parameters efficiently through the properties structure