<commit_before><!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Observable.js Performance Tests/Observations</title>
</head>
<body>
  <script src="../lib/observable.js"></script>
  <script>
  void function() {
    var obs;

    var beforeEach = function() {
      obs = observable();
      for (var i = 50; i--;) {
        obs.on('test', function(){});
      }
    };

    var test = function(name, callback) {
      beforeEach();
      var cnt = 500000;
      console.time(name);
      while (cnt--) {
        callback();
      }
      console.timeEnd(name);
    };

    // #on
    test('#on() add single callback', function() {
      obs.on('test', function(){});
    });
    test('#on() add multiple callbacks', function() {
      obs.on('test', function(){}, function(){}, function(){});
    });
    test('#on() add array of callbacks', function() {
      obs.on('test', [function(){}, function(){}, function(){}]);
    });

    // #off
    test('#off() remove single callback', function() {
      obs.off('test', function(){});
    });
    test('#off() remove multiple callbacks', function() {
      obs.off('test', function(){}, function(){}, function(){});
    });
    test('#off() remove array of callbacks', function() {
      obs.off('test', [function(){}, function(){}, function(){}]);
    });

    // #fire
    test('#fire() invoke event with arguments', function() {
      obs.fire('test', 'uno', 'dos', 'tres', 4, /cinco/);
    });
  }();
  </script>
</body>
</html><commit_msg>Named functions -> easier to follow in Chrome profiler.<commit_after><!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Observable.js Performance Tests/Observations</title>
</head>
<body>
  <script src="../lib/observable.js"></script>
  <script>
    var obs;

    function beforeEach() {
      obs = observable();
      for (var i = 50; i--;) {
        obs.on('test', function(){});
      }
    };

    function test(name, callback) {
      beforeEach();
      var cnt = 500000;
      console.time(name);
      while (cnt--) {
        callback();
      }
      console.timeEnd(name);
    };

    // #on
    test('#on() add single callback', function onSingle() {
      obs.on('test', function(){});
    });
    test('#on() add multiple callbacks', function onMultiple() {
      obs.on('test', function(){}, function(){}, function(){});
    });
    test('#on() add array of callbacks', function onArray() {
      obs.on('test', [function(){}, function(){}, function(){}]);
    });

    // #off
    test('#off() remove single callback', function offSingle() {
      obs.off('test', function(){});
    });
    test('#off() remove multiple callbacks', function offMultiple() {
      obs.off('test', function(){}, function(){}, function(){});
    });
    test('#off() remove array of callbacks', function offArray() {
      obs.off('test', [function(){}, function(){}, function(){}]);
    });

    // #fire
    test('#fire() invoke event with arguments', function fireArguments() {
      obs.fire('test', 'uno', 'dos', 'tres', 4, /cinco/);
    });
  </script>
</body>
</html>
{'fraction_non_alphanumeric': 0.22330097087378642, 'fraction_numerical': 0.006472491909385114, 'mean_word_length': 2.8445273631840795, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 32, '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': '6765302', 'n_tokens_mistral': 963, 'n_tokens_neox': 932, 'n_words': 235}