<commit_before>require 'nydp'
require 'nydp/error'

module Nydp::Builtin
  module Base
    include Nydp::Helper

    def invoke_1 vm
      invoke vm, Nydp.NIL
    end

    def invoke_2 vm, arg
      invoke vm, cons(arg)
    end

    def invoke_3 vm, arg_0, arg_1
      invoke vm, cons(arg_0, cons(arg_1))
    end

    def invoke_4 vm, arg_0, arg_1, arg_2
      invoke vm, cons(arg_0, cons(arg_1, cons(arg_2)))
    end

    def invoke vm, args
      builtin_invoke vm, args
    rescue Exception => e
      handle_error e, args
    end
<commit_msg>performance: create framework to optimised builtins<commit_after>require 'nydp'
require 'nydp/error'

module Nydp::Builtin
  module Base
    include Nydp::Helper

    def builtin_invoke_1 vm             ; builtin_invoke vm, Nydp.NIL                     ; end
    def builtin_invoke_2 vm, a          ; builtin_invoke vm, cons(a)                      ; end
    def builtin_invoke_3 vm, a0, a1     ; builtin_invoke vm, cons(a0, cons(a1))           ; end
    def builtin_invoke_4 vm, a0, a1, a2 ; builtin_invoke vm, cons(a0, cons(a1, cons(a2))) ; end

    def invoke_1 vm
      builtin_invoke_1 vm
    rescue Exception => e
      handle_error e, Nydp.NIL
    end

    def invoke_2 vm, arg
      builtin_invoke_2 vm, arg
    rescue Exception => e
      handle_error e, cons(arg)
    end

    def invoke_3 vm, arg_0, arg_1
      builtin_invoke_3 vm, arg_0, arg_1
    rescue Exception => e
      handle_error e, cons(arg_0, cons(arg_1))
    end

    def invoke_4 vm, arg_0, arg_1, arg_2
      builtin_invoke_4 vm, arg_0, arg_1, arg_2
    rescue Exception => e
      handle_error e, cons(arg_0, cons(arg_1, cons(arg_2)))
    end

    def invoke vm, args
      builtin_invoke vm, args
    rescue Exception => e
      handle_error e, args
    end

{'fraction_non_alphanumeric': 0.07571508693213685, 'fraction_numerical': 0.02860347728547392, 'mean_word_length': 2.3851992409867173, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '614844', 'n_tokens_mistral': 643, 'n_tokens_neox': 634, 'n_words': 190}