<commit_before>/**
 * Trail
 * @constructor
 */
function Trail(avatar)
{
    BaseTrail.call(this, avatar);

    this.path  = null;
    this.paths = [];

    this.createPath();
}

Trail.prototype = Object.create(BaseTrail.prototype);

/**
 * Create path
 */
Trail.prototype.createPath = function()
{
    this.path = new paper.Path({
        strokeColor: this.color,
        strokeWidth: this.radius * 2 * paper.sceneScale,
        strokeCap: 'round',
        strokeJoin: 'round',
        fullySelected: false
    });
};

/**
 * Set position
 */
Trail.prototype.setPosition = function(point)
{
    if (this.path.lastSegment) {
        this.path.lastSegment.point.x = point[0] * paper.sceneScale;
        this.path.lastSegment.point.y = point[1] * paper.sceneScale;
    }
};

/**
 * Add point
 *
 * @param {Array} point
 */
Trail.prototype.addPoint = function(point)
{
    var x = point[0] * paper.sceneScale,
        y = point[1] * paper.sceneScale;

    if (!this.path.length) {
        this.path.add(x, y);
    }

    this.path.add(x, y);
};

/**
 * Add point
 *
 * @param {Array} point
 */
Trail.prototype.clear = function()
{
    this.path.simplify(1);
    this.paths.push(this.path);
    this.createPath();
};

/**
 * Clear Paths
 */
Trail.prototype.clearPaths = function()
{
    for (var i = this.paths.length - 1; i >= 0; i--) {
        this.paths[i].remove();
    }

    this.paths = [];
};<commit_msg>Added rasterize for perf<commit_after>/**
 * Trail
 * @constructor
 */
function Trail(avatar)
{
    BaseTrail.call(this, avatar);

    this.path  = null;
    this.paths = [];

    this.createPath();
}

Trail.prototype = Object.create(BaseTrail.prototype);

/**
 * Create path
 */
Trail.prototype.createPath = function()
{
    this.path = new paper.Path({
        strokeColor: this.color,
        strokeWidth: this.radius * 2 * paper.sceneScale,
        strokeCap: 'round',
        strokeJoin: 'round',
        fullySelected: false
    });
};

/**
 * Set position
 */
Trail.prototype.setPosition = function(point)
{
    if (this.path.lastSegment) {
        this.path.lastSegment.point.x = point[0] * paper.sceneScale;
        this.path.lastSegment.point.y = point[1] * paper.sceneScale;
    }
};

/**
 * Add point
 *
 * @param {Array} point
 */
Trail.prototype.addPoint = function(point)
{
    var x = point[0] * paper.sceneScale,
        y = point[1] * paper.sceneScale;

    if (!this.path.length) {
        this.path.add(x, y);
    }

    this.path.add(x, y);
};

/**
 * Add point
 *
 * @param {Array} point
 */
Trail.prototype.clear = function()
{
    this.paths.push(this.path.rasterize());
    this.path.remove();

    this.createPath();
};

/**
 * Clear Paths
 */
Trail.prototype.clearPaths = function()
{
    for (var i = this.paths.length - 1; i >= 0; i--) {
        this.paths[i].remove();
    }

    this.paths = [];
};
{'fraction_non_alphanumeric': 0.1723651744800846, 'fraction_numerical': 0.005287275290800141, 'mean_word_length': 2.5037037037037035, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4408408', 'n_tokens_mistral': 999, 'n_tokens_neox': 980, 'n_words': 179}