-
Notifications
You must be signed in to change notification settings - Fork 213
Open
Labels
performancePerformance-related improvements or regressionsPerformance-related improvements or regressions
Description
Currently compile_hint barely contains any logic.
cairo-vm/vm/src/hint_processor/hint_processor_definition.rs
Lines 33 to 52 in 065c8f4
| fn compile_hint( | |
| &self, | |
| //Block of hint code as String | |
| hint_code: &str, | |
| //Ap Tracking Data corresponding to the Hint | |
| ap_tracking_data: &ApTracking, | |
| //Map from variable name to reference id number | |
| //(may contain other variables aside from those used by the hint) | |
| reference_ids: &HashMap<String, usize>, | |
| //List of all references (key corresponds to element of the previous dictionary) | |
| references: &[HintReference], | |
| // Identifiers stored in the hint's program. | |
| constants: Rc<HashMap<String, Felt252>>, | |
| ) -> Result<Box<dyn Any>, VirtualMachineError> { | |
| Ok(any_box!(HintProcessorData { | |
| code: hint_code.to_string(), | |
| ap_tracking: ap_tracking_data.clone(), | |
| ids_data: get_ids_data(reference_ids, references)?, | |
| constants, | |
| })) |
We should investigate if there is logic that can be moved to the compilation step. The idea is to properly take advantage of compile_hint/execute_hint, instead of using compile_hint as a placeholder.
Some ideas:
- All references are computed, regardless of whether they are used or not. This accounts for 7% of the execution
- When executing a hint, we need to match the hint code. The match is really big, which could affect performance.
- Constant lookup is being done on execution, but could be moved to compilation.
Metadata
Metadata
Assignees
Labels
performancePerformance-related improvements or regressionsPerformance-related improvements or regressions
Type
Projects
Status
In Progress