Skip to content

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

  1. Keep reactions lightweight - Avoid complex computations
  2. Use data store efficiently - Don't store large objects
  3. Minimize file I/O - Write essential data only
  4. Handle errors gracefully - Don't impact other reactions
  5. 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 arbitraries or detection features

TIP

Jibril detection mechanisms are faster and optimized. Use reactions for fine-grained business logic, not to replace detection logic.