Appearance
Performance
Optimization guidelines for efficient reactions.
Performance Characteristics
- Parallel Execution - Multiple reactions run concurrently
- V8 Compilation - JavaScript pre-compiled for fast execution
- Context Isolation - Each reaction runs in isolated environment
- Memory Management - Automatic cleanup of reaction contexts
- Resource Limits - Built-in safeguards prevent exhaustion
Best Practices
- Keep reactions lightweight - Avoid complex computations
- Use data store efficiently - Don't store large objects
- Minimize file I/O - Write essential data only
- Handle errors gracefully - Don't impact other reactions
- Test thoroughly - Validate before production
Optimized Reaction Example
javascript
function process(data) {
// Fast path for common cases
if (!data.process || !data.process.cmd) {
return;
}
// Efficient data access
let cmd = data.process.cmd;
let isHighRisk = cmd.includes("wget") || cmd.includes("curl");
if (isHighRisk) {
Info("High-risk process: " + cmd);
// Efficient data store operations
let count = parseInt(DataGet("risk_count") || "0") + 1;
DataSet("risk_count", String(count));
// Act only when necessary
if (count > 5) {
NetBlockIp();
}
}
}Detection vs Reaction Logic
Jibril Detection Mechanism:
- Optimized for enhanced results
- Efficient caching
- Additional functionalities
Reaction Logic:
- Responds to events
- Not responsible for filtering or decision-making
- Filtering handled by
arbitrariesor detection features
TIP
Jibril detection mechanisms are faster and optimized. Use reactions for fine-grained business logic, not to replace detection logic.