8000 Set max-old-space-size programmatically by tjomson · Pull Request #717 · git-truck/git-truck · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Set max-old-space-size programmatically #717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,6 @@ You can also define files to ignore.
}
```

### Very large repositories

> [!TIP]
> If the repository you intend to analyze is very large (300k+ commits), we recommend to increase the memory available to nodejs by setting the environment variable `NODE_OPTIONS` to `--max-old-space-size=4096` before starting Git Truck, otherwise analyzation might crash.
> If your repository has more than 1 million commits, it is unlikely that Git Truck can successfully analyze it, even with higher memory limit.

## Star History

[![Star History Chart](https://api.star-history.com/svg?repos=git-truck/git-truck&type=Date)](https://star-history.com/#git-truck/git-truck&Date)
8 changes: 4 additions & 4 deletions src/analyzer/analyze.server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { promises as fs } from "fs"
import { promises as fs } from "node:fs"
import type {
GitBlobObject,
GitCommitObject,
Expand All @@ -13,15 +13,15 @@ import { log, setLogLevel } from "./log.server"
import { describeAsyncJob, writeRepoToFile, getDirName } from "./util.server"
import { GitCaller } from "./git-caller.server"
import { emptyGitCommitHash } from "./constants"
import { resolve, isAbsolute, sep } from "path"
import { performance } from "perf_hooks"
import { resolve, isAbsolute, sep } from "node:path"
import { performance } from "node:perf_hooks"
import { hydrateData } from "./hydrate.server"
import {} from "@remix-run/node"
import ignore from "ignore"
import { applyIgnore, applyMetrics, initMetrics, TreeCleanup } from "./postprocessing.server"
import pkg from "../../package.json"
import { getCoAuthors } from "./coauthors.server"
import { exec } from "child_process"
import { exec } from "node:child_process"
import { makeDupeMap, nameUnion } from "~/authorUnionUtil.server"

let repoDir = "."
Expand Down
4 changes: 2 additions & 2 deletions src/analyzer/args.server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import yargsParser from "yargs-parser"
import { promises as fs } from "fs"
import { resolve } from "path"
import { promises as fs } from "node:fs"
import { resolve } from "node:path"
import type { TruckConfig, TruckUserConfig } from "./model"
import { GitCaller } from "./git-caller.server"
import { getBaseDirFromPath } from "./util.server"
Expand Down
6 changes: 3 additions & 3 deletions src/analyzer/git-caller.server.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { log } from "./log.server"
import { describeAsyncJob, getBaseDirFromPath, getDirName, promiseHelper, runProcess } from "./util.server"
import { resolve, join } from "path"
import { promises as fs, existsSync } from "fs"
import { resolve, join } from "node:path"
import { promises as fs, existsSync } from "node:fs"
import type { AnalyzerData, GitRefs, Repository } from "./model"
import { AnalyzerDataInterfaceVersion } from "./model"
import { branchCompare, semverCompare } from "~/util"
import os from "os"
import os from "node:os"

export enum ANALYZER_CACHE_MISS_REASONS {
OTHER_REPO = "The cache was not created for this repo",
Expand Down
4 changes: 3 additions & 1 deletion src/analyzer/hydrate.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import { GitCaller } from "./git-caller.server"
import { getCoAuthors } from "./coauthors.server"
import { log } from "./log.server"
import { gitLogRegex, contribRegex } from "./constants"
import { cpus } from "os"
import { cpus } from "node:os"
import { setAnalyzationStatus } from "./analyze.server"
import { setFlagsFromString } from "node:v8"

let renamedFiles: Map<string, { path: string; timestamp: number }[]>
let authors: Set<string>
Expand Down Expand Up @@ -101,6 +102,7 @@ export let progress = 0
export let totalCommitCount = Infinity

export async function hydrateData(commit: GitCommitObject): Promise<[HydratedGitCommitObject, string[]]> {
setFlagsFromString('--max-old-space-size=4096')
const data = commit as HydratedGitCommitObject
const fileMap = convertFileTreeToMap(data.tree)
initially_mut(data)
Expand Down
6 changes: 3 additions & 3 deletions src/analyzer/util.server.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { spawn } from "child_process"
import { existsSync, promises as fs } from "fs"
import { spawn } from "node:child_process"
import { existsSync, promises as fs } from "node:fs"
import type { Spinner } from "nanospinner"
import { createSpinner } from "nanospinner"
import { dirname, resolve as resolvePath, sep } from "node:path"
import { getLogLevel, log, LOG_LEVEL } from "./log.server"
import type { GitTreeObject, AnalyzerData, GitObject } from "./model"
import { performance } from "perf_hooks"
import { performance } from "node:perf_hooks"
import c from "ansi-colors"
import pkg from "../../package.json"
import getLatestVersion from "latest-version"
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ function Node({ d, isSearchMatch }: { d: CircleOrRectHiearchyNode; isSearchMatch
{...commonProps}
className={clsx({
"cursor-pointer": isBlob(d.data),
"transition-all duration-1000 ease-in-out": transitionsEnabled,
"transition-all duration-500 ease-in-out": transitionsEnabled,
"animate-stroke-pulse": isSearchMatch,
"stroke-black/20": isTree(d.data)
})}
Expand Down
0