<commit_before>(function( window, document, undefined ) {
  'use strict';

  // Global animation state.
  var anim;

  // Utility functions.
  // In the range [min, max).
  function randomInt( min, max ) {
    return min + Math.random() * ( max - min );
  }

  function randomSign() {
    return Math.random() < 0.5 ? -1 : 1;
  }


  /**
   * Normally, I wouldn't use a monolithic file structure, but for the sake
   * of speed, here we go.
   *
   * I'm also not including a requestAnimationFrame polyfill, but it would be
   * trivial to add one.
   *
   * This code targets the latest version of Chrome Canary/Chrome Stable.
   */
  function Animation() {
    // We don't need the accuracy of performance.now().
    this.prevTime = Date.now();
    this.currTime = this.prevTime;

    this.running = true;

    this.elements = [];

    this.width = window.innerWidth;
    this.height = window.innerHeight;
  }

  anim = new Animation();

  window.addEventListener( 'resize', function() {
    anim.width = window.innerWidth;
    anim.height = window.innerHeight;
  });


  function Element( options ) {
    options = options || {};

    var el = options.el || '';
    var x = options.x || 0;
    var y = options.y || 0;

    if ( el && typeof el === 'string' ) {
      el = document.querySelector( el );
    }

    if ( el instanceof HTMLElement ) {
      this.el = el;
    } else {
      this.el = document.createElement( 'div' );
    }
<commit_msg>List some optimizations.<commit_after>/**
 * Optimizations:
 *
 * - Use only CSS translates with translateZ(0) to avoid repainting.
 * - Cache window/element dimensions to save on lookup time (profile revealed
 *   significant performance increase in Element's update() method).
 *
 * Optimizations that did not work:
 *
 * - Only updating transform if the element had moved at least some minimum distance.
 */

(function( window, document, undefined ) {
  'use strict';

  // Global animation state.
  var anim;

  // Utility functions.
  // In the range [min, max).
  function randomInt( min, max ) {
    return min + Math.random() * ( max - min );
  }

  function randomSign() {
    return Math.random() < 0.5 ? -1 : 1;
  }


  /**
   * Normally, I wouldn't use a monolithic file structure, but for the sake
   * of speed, here we go.
   *
   * I'm also not including a requestAnimationFrame polyfill, but it would be
   * trivial to add one.
   *
   * This code targets the latest version of Chrome Canary/Chrome Stable.
   */
  function Animation() {
    // We don't need the accuracy of performance.now().
    this.prevTime = Date.now();
    this.currTime = this.prevTime;

    this.running = true;

    this.elements = [];

    this.width = window.innerWidth;
    this.height = window.innerHeight;
  }

  anim = new Animation();

  window.addEventListener( 'resize', function() {
    anim.width = window.innerWidth;
    anim.height = window.innerHeight;
  });


  function Element( options ) {
    options = options || {};

    var el = options.el || '';
    var x = options.x || 0;
    var y = options.y || 0;

    if ( el && typeof el === 'string' ) {
      el = document.querySelector( el );
    }

    if ( el instanceof HTMLElement ) {
      this.el = el;
    } else {
      this.el = document.createElement( 'div' );
    }

    // Only so we can determine the element dimensions.
{'fraction_non_alphanumeric': 0.12563565659587198, 'fraction_numerical': 0.003888722704157942, 'mean_word_length': 2.508919202518363, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '1937221', 'n_tokens_mistral': 1041, 'n_tokens_neox': 985, 'n_words': 336}