<commit_before>import settings from './settings';
import viewer from './viewer';

let prevTime;
let frames = 0;
let fps = 60;
let lastFps = 60;
let steadyCount = 0;
let hidden = false;
let cullDistance = settings.cullDistance;
let fogNear = 100;

document.addEventListener('visibilitychange', () => {
  hidden = document.hidden;
});

export default (interval = 3000) => {
  if (hidden) {
    prevTime = null;
    frames = 0;
    return fps;
  }
  frames++;
  const time = (performance || Date).now();
  if (prevTime == null) prevTime = time;
  if (time > prevTime + interval) {
    fps = (frames * 1000) / (time - prevTime);
    fps = Math.min(55, Math.round(fps * 0.2) * 5);
    frames = 0;
    prevTime = time;

    if (fps === lastFps) {
      steadyCount++;
    } else {
      steadyCount = 0;
    }
    lastFps = fps;
    const lastCullDistance = cullDistance;
    if (fps < 55) {
      cullDistance = Math.max(
        settings.minCullDistance,<commit_msg>fog should start near, not far away<commit_after>import settings from './settings';
import viewer from './viewer';

let prevTime;
let frames = 0;
let fps = 60;
let lastFps = 60;
let steadyCount = 0;
let hidden = false;
let cullDistance = settings.cullDistance;
let fogNear = settings.fogNear;

document.addEventListener('visibilitychange', () => {
  hidden = document.hidden;
});

export default (interval = 3000) => {
  if (hidden) {
    prevTime = null;
    frames = 0;
    return fps;
  }
  frames++;
  const time = (performance || Date).now();
  if (prevTime == null) prevTime = time;
  if (time > prevTime + interval) {
    fps = (frames * 1000) / (time - prevTime);
    fps = Math.min(55, Math.round(fps * 0.2) * 5);
    frames = 0;
    prevTime = time;

    if (fps === lastFps) {
      steadyCount++;
    } else {
      steadyCount = 0;
    }
    lastFps = fps;
    const lastCullDistance = cullDistance;
    if (fps < 55) {
      cullDistance = Math.max(
        settings.minCullDistance,
{'fraction_non_alphanumeric': 0.1388463501786626, 'fraction_numerical': 0.026033690658499236, 'mean_word_length': 2.888888888888889, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1396083', 'n_tokens_mistral': 715, 'n_tokens_neox': 660, 'n_words': 189}