mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-30 07:06:40 +08:00
chore: update benchmark
This commit is contained in:
parent
a7ade4676d
commit
f43cb4b63f
21
README.md
21
README.md
@ -3,7 +3,7 @@
|
|||||||
<h1>Soybean Admin</h1>
|
<h1>Soybean Admin</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
This project is forded from [Soybean Admin](https://github.com/honghuangdc/soybean-admin). And we migrate this project from Vite to Farm reusing Vite plugins, after migrate to Farm, this project is 5 times faster than vite in dev and 10 times faster than Vite in prod.
|
This project is forded from [Soybean Admin](https://github.com/honghuangdc/soybean-admin). And we migrate this project from Vite to Farm reusing Vite plugins.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run dev:farm # start with Farm
|
npm run dev:farm # start with Farm
|
||||||
@ -13,8 +13,19 @@ npm run dev # start with Vite
|
|||||||
npm run build # build with Vite
|
npm run build # build with Vite
|
||||||
```
|
```
|
||||||
|
|
||||||
|
After migrate to Farm, this project is 2 times faster than Vite in Dev, and 6x times faster in Prod!
|
||||||
|
|
||||||
Performance Compare:
|
Performance Compare:
|
||||||
||Cold Start(Server Ready + Page Rendered)|Build|Compare|
|
||Cold Start(Server Ready + Page Rendered)|
|
||||||
|---|---|---|---|---|
|
|---|---|---|---|
|
||||||
|Farm| | | 7.6s | |
|
|Farm| 3.5s | 4s |
|
||||||
|Vite| 9.4s | 25.2s | |
|
|Vite| 7.5s | 24.1s |
|
||||||
|
|Compare| Farm is 2x faster than Vite| Farm is 6x faster than Vite|
|
||||||
|
|
||||||
|
So this means when using Farm, you can get better performance in both dev and prod, and you can avoid a lot of issues of Vite:
|
||||||
|
|
||||||
|
- No huge amount of requests in Dev
|
||||||
|
- Consistency between dev and prod
|
||||||
|
- Flexible bundling configuration
|
||||||
|
|
||||||
|
And it is really easy to migrate your project from Vite to Farm, just move your `plugins` in `vite.config.ts` to `vitePlugins` in `farm.config.ts`
|
||||||
|
@ -2,7 +2,7 @@ import type { PluginOption } from 'vite';
|
|||||||
import vue from '@vitejs/plugin-vue';
|
import vue from '@vitejs/plugin-vue';
|
||||||
import vueJsx from '@vitejs/plugin-vue-jsx';
|
import vueJsx from '@vitejs/plugin-vue-jsx';
|
||||||
import unocss from '@unocss/vite';
|
import unocss from '@unocss/vite';
|
||||||
import progress from 'vite-plugin-progress';
|
// import progress from 'vite-plugin-progress';
|
||||||
import VueDevtools from 'vite-plugin-vue-devtools';
|
import VueDevtools from 'vite-plugin-vue-devtools';
|
||||||
import pageRoute from '@soybeanjs/vite-plugin-vue-page-route';
|
import pageRoute from '@soybeanjs/vite-plugin-vue-page-route';
|
||||||
import unplugin from './unplugin';
|
import unplugin from './unplugin';
|
||||||
@ -26,8 +26,8 @@ export function setupVitePlugins(viteEnv: ImportMetaEnv): (PluginOption | Plugin
|
|||||||
VueDevtools(),
|
VueDevtools(),
|
||||||
...unplugin(viteEnv),
|
...unplugin(viteEnv),
|
||||||
unocss(),
|
unocss(),
|
||||||
mock(viteEnv),
|
mock(viteEnv)
|
||||||
progress()
|
// progress()
|
||||||
];
|
];
|
||||||
|
|
||||||
if (viteEnv.VITE_VISUALIZER === 'Y') {
|
if (viteEnv.VITE_VISUALIZER === 'Y') {
|
||||||
|
@ -17,6 +17,8 @@ const srcPath = getSrcPath();
|
|||||||
const isOpenProxy = viteEnv.VITE_HTTP_PROXY === 'Y';
|
const isOpenProxy = viteEnv.VITE_HTTP_PROXY === 'Y';
|
||||||
const envConfig = getServiceEnvConfig(viteEnv);
|
const envConfig = getServiceEnvConfig(viteEnv);
|
||||||
|
|
||||||
|
console.log('start', Date.now());
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
root: rootPath,
|
root: rootPath,
|
||||||
compilation: {
|
compilation: {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { defineConfig, loadEnv } from 'vite';
|
import { defineConfig, loadEnv } from 'vite';
|
||||||
import { createViteProxy, getRootPath, getSrcPath, setupVitePlugins, viteDefine } from './build';
|
import { createViteProxy, getRootPath, getSrcPath, setupVitePlugins, viteDefine } from './build';
|
||||||
import { getServiceEnvConfig } from './.env-config';
|
import { getServiceEnvConfig } from './.env-config';
|
||||||
|
console.log('start', Date.now());
|
||||||
|
|
||||||
export default defineConfig(configEnv => {
|
export default defineConfig(configEnv => {
|
||||||
const viteEnv = loadEnv(configEnv.mode, process.cwd()) as unknown as ImportMetaEnv;
|
const viteEnv = loadEnv(configEnv.mode, process.cwd()) as unknown as ImportMetaEnv;
|
||||||
@ -31,7 +32,7 @@ export default defineConfig(configEnv => {
|
|||||||
server: {
|
server: {
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
port: 3200,
|
port: 3200,
|
||||||
// open: true,
|
open: true,
|
||||||
proxy: createViteProxy(isOpenProxy, envConfig)
|
proxy: createViteProxy(isOpenProxy, envConfig)
|
||||||
},
|
},
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
|
Loading…
Reference in New Issue
Block a user