Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

slowly purge dead code

Louis Beaumont6abe72cdcfa6
diff --git a/Cargo.toml b/Cargo.toml
index b938f7e31..a7aa1bda8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -41,6 +41,7 @@ criterion = { version = "0.5.1", features = ["async_tokio"] }
vcpkg = "0.2"
[patch.crates-io]
+# enables chinese mirror (hf is banned in china)
hf-hub = { git = "https://github.com/king-jingxiang/hf-hub" }
[workspace.metadata.vcpkg]
@@ -48,3 +49,13 @@ git = "https://github.com/microsoft/vcpkg"
rev = "2023.04.15"
dynamic = true
+[profile.release]
+# default settings
+lto = false
+
+# add release-lto profile for people that want high performance
+[profile.release-lto]
+inherits = "release"
+lto = true
+opt-level = "z"
+codegen-units = 1
diff --git a/content/docs/pages/docs/getting-started.mdx b/content/docs/pages/docs/getting-started.mdx
index b2f34f91f..56878c877 100644
--- a/content/docs/pages/docs/getting-started.mdx
+++ b/content/docs/pages/docs/getting-started.mdx
@@ -310,6 +310,13 @@ you can probably remove the updater config in your fork if you don't need it.
### other options
- check this [docker setup](https://github.com/sabrehagen/desktop-environment/blob/d273442143260b414c581d7a53be0618ca822bc0/docker/Dockerfile#L409-L421)
+- use
+```bash
+export CARGO_PROFILE_RELEASE_LTO=true
+export CARGO_PROFILE_RELEASE_OPT_LEVEL=z
+export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
+```
+to build a faster and smaller release but takes longer to build
## for businesses
diff --git a/screenpipe-app-tauri/scripts/pre_build.js b/screenpipe-app-tauri/scripts/pre_build.js
index a143f2a64..ed2d38496 100644
--- a/screenpipe-app-tauri/scripts/pre_build.js
+++ b/screenpipe-app-tauri/scripts/pre_build.js
@@ -27,6 +27,7 @@ const config = {
ffmpegName: 'ffmpeg-7.0-windows-desktop-vs2022-default',
ffmpegUrl: 'https://unlimited.dl.sourceforge.net/project/avbuild/windows-desktop/ffmpeg-7.0-windows-desktop-vs2022-default.7z?viasf=1',
+ // TODO unused dead code?
openBlasName: 'OpenBLAS-0.3.26-x64',
openBlasUrl: 'https://github.com/OpenMathLib/OpenBLAS/releases/download/v0.3.26/OpenBLAS-0.3.26-x64.zip',
@@ -40,7 +41,6 @@ const config = {
'tesseract-ocr',
'libtesseract-dev',
'ffmpeg',
- 'libopenblas-dev', // Runtime
'pkg-config',
'build-essential',
'libglib2.0-dev',
@@ -53,8 +53,6 @@ const config = {
'libavfilter-dev',
'libavdevice-dev', // FFMPEG
'libasound2-dev', // cpal
- 'libomp-dev', // OpenMP in ggml.ai
- 'libstdc++-12-dev', //ROCm
'libxdo-dev',
],
},
@@ -237,9 +235,7 @@ if (platform == 'linux') {
// Install APT packages
try {
await $`sudo apt-get update`
- if (hasFeature('opencl')) {
- config.linux.aptPackages.push('libclblast-dev')
- }
+
for (const name of config.linux.aptPackages) {
await $`sudo apt-get install -y ${name}`
}
@@ -496,89 +492,7 @@ if (platform == 'macos') {
}
-// ! TODO remove all this dead code?
-
-// Nvidia
-let cudaPath
-if (hasFeature('cuda')) {
- if (process.env['CUDA_PATH']) {
- cudaPath = process.env['CUDA_PATH']
- } else if (platform === 'windows') {
- const cudaRoot = 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\'
- cudaPath = 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.5'
- if (await fs.exists(cudaRoot)) {
- const folders = await fs.readdir(cudaRoot)
- if (folders.length > 0) {
- cudaPath = cudaPath.replace('v12.5', folders[0])
- }
- }
- }
-
- if (process.env.GITHUB_ENV) {
- console.log('CUDA_PATH', cudaPath)
- }
-
- if (platform === 'windows') {
- const windowsConfig = {
- bundle: {
- resources: {
- 'ffmpeg\\bin\\x64\\*': './',
- 'openblas\\bin\\*.dll': './',
- [`${cudaPath}\\bin\\cudart64_*`]: './',
- [`${cudaPath}\\bin\\cublas64_*`]: './',
- [`${cudaPath}\\bin\\cublasLt64_*`]: './',
- 'onnxruntime*\\lib\\*.dll': './',
- },
- externalBin: [
- 'screenpipe'
- ]
- },
- }
- await fs.writeFile('tauri.windows.conf.json', JSON.stringify(windowsConfig, null, 4))
- }
- if (platform === 'linux') {
- // Add cuda toolkit depends package
- const tauriConfigContent = await fs.readFile('tauri.linux.conf.json', { encoding: 'utf-8' })
- const tauriConfig = JSON.parse(tauriConfigContent)
- tauriConfig.bundle.linux.deb.depends.push('nvidia-cuda-toolkit')
- await fs.writeFile('tauri.linux.conf.json', JSON.stringify(tauriConfig, null, 4))
- }
-}
-if (hasFeature('opencl')) {
- if (platform === 'windows') {
- const tauriConfigContent = await fs.readFile('tauri.windows.conf.json', { encoding: 'utf-8' })
- const tauriConfig = JSON.parse(tauriConfigContent)
- tauriConfig.bundle.resources['clblast\\bin\\*.dll'] = './'
- tauriConfig.bundle.resources['C:\\vcpkg\\packages\\opencl_x64-windows\\bin\\*.dll'] = './'
- await fs.writeFile('tauri.windows.conf.json', JSON.stringify(tauriConfig, null, 4))
- }
-}
-
-// OpenBlas
-if (hasFeature('openblas')) {
- if (platform === 'windows') {
- const tauriConfigContent = await fs.readFile('tauri.windows.conf.json', { encoding: 'utf-8' })
- const tauriConfig = JSON.parse(tauriConfigContent)
- tauriConfig.bundle.resources['openblas\\bin\\*.dll'] = './'
- await fs.writeFile('tauri.windows.conf.json', JSON.stringify(tauriConfig, null, 4))
- }
-}
-
-// ROCM
-let rocmPath = '/opt/rocm'
-if (hasFeature('rocm')) {
- if (process.env.GITHUB_ENV) {
- console.log('ROCM_PATH', rocmPath)
- }
- if (platform === 'linux') {
- // Add rocm toolkit depends package
- const tauriConfigContent = await fs.readFile('tauri.linux.conf.json', { encoding: 'utf-8' })
- const tauriConfig = JSON.parse(tauriConfigContent)
- tauriConfig.bundle.linux.deb.depends.push('rocm')
- await fs.writeFile('tauri.linux.conf.json', JSON.stringify(tauriConfig, null, 4))
- }
-}
// Development hints
if (!process.env.GITHUB_ENV) {
@@ -594,22 +508,6 @@ if (!process.env.GITHUB_ENV) {
console.log(`$env:OPENBLAS_PATH = "${exports.openBlas}"`)
console.log(`$env:LIBCLANG_PATH = "${exports.libClang}"`)
console.log(`$env:PATH += "${exports.cmake}"`)
- if (hasFeature('older-cpu')) {
- console.log(`$env:WHISPER_NO_AVX = "ON"`)
- console.log(`$env:WHISPER_NO_AVX2 = "ON"`)
- console.log(`$env:WHISPER_NO_FMA = "ON"`)
- console.log(`$env:WHISPER_NO_F16C = "ON"`)
- }
- if (hasFeature('cuda')) {
- console.log(`$env:CUDA_PATH = "${cudaPath}"`)
- }
- if (hasFeature('opencl')) {
- console.log(`$env:CLBlast_DIR = "${exports.clblast}"`)
- }
- if (hasFeature('rocm')) {
- console.log(`$env:ROCM_VERSION = "6.1.2"`)
- console.log(`$env:ROCM_PATH = "${rocmPath}"`)
- }
}
if (!process.env.GITHUB_ENV) {
console.log('bun tauri build')
@@ -632,13 +530,6 @@ if (process.env.GITHUB_ENV) {
const openblas = `OPENBLAS_PATH=${exports.openBlas}\n`
console.log('Adding ENV', openblas)
await fs.appendFile(process.env.GITHUB_ENV, openblas)
-
- if (hasFeature('opencl')) {
- const clblast = `CLBlast_DIR=${exports.clblast}\n`
- console.log('Adding ENV', clblast)
- await fs.appendFile(process.env.GITHUB_ENV, clblast)
- }
-
}
}
diff --git a/screenpipe-app-tauri/src-tauri/tauri.linux.conf.json b/screenpipe-app-tauri/src-tauri/tauri.linux.conf.json
index e38aa36a4..a84c27153 100644
--- a/screenpipe-app-tauri/src-tauri/tauri.linux.conf.json
+++ b/screenpipe-app-tauri/src-tauri/tauri.linux.conf.json
@@ -13,8 +13,7 @@
"depends": [
"tesseract-ocr",
"libtesseract-dev",
- "ffmpeg",
- "libopenblas-dev"
+ "ffmpeg"
]
}
}