Comments (14)
I fixed the random panic, and ran it.
(Note: swc is a compiler, and it transforms code instead of bundling it)
$ rm -rf ./dist && time npx swc bench/three -d dist -s
Successfully compiled 6091 files with swc.
npx swc bench/three -d dist -s 10.72s user 2.66s system 245% cpu 5.446 total
5.446 seconds / 6091 file = 0.00089410605 seconds per file = 0.894ms / file.
from esbuild.
So I'm not at all familiar with SWC and Pax but it seems like these tools don't do the same thing as the other tools that I'm benchmarking. To be relevant for my benchmark, the build tool must be able to do a full production build.
SWC's minification seems to be whitespace-only as far as I can tell? Pax appears to be only for development and the output is too verbose for a production build.
The smallest size I could get for SWC and Pax with minification enabled is 15mb. This is far bigger than the other tools in my benchmark which all generate bundles around 5.8mb. When it worked, the build time for running SWC followed by Pax was around 2.5 seconds, which seems promising. SWC logs 2,530 errors to the console during the build process though so it's possible that a big part of the build time is being spent doing console I/O, and the build time would be much better if it didn't log so many errors.
SWC also appears to be somewhat unstable. When I run it on my benchmark, around 50% of the time it panics and crashes instead of completing successfully. The specific panic is fatal runtime error: failed to initiate panic, error 5
. No idea what that means.
I'm going to close this issue because I believe SWC and Pax are not yet appropriate tools for production builds, and so aren't relevant for my benchmark.
from esbuild.
@dy Currently, swc does not have a feature to bundle files.
I'm working on it, but it would take some time.
from esbuild.
@evanw Can you share the code which crashed swc?
Also, I think you were targetting es3, and errors comes from the getter / setters.
from esbuild.
Can you share the code which crashed swc?
Of course:
$ git clone [email protected]:evanw/esbuild.git
$ make bench/three
$ npm i @swc/[email protected] @swc/[email protected]
$ npx swc bench/three -d dist -s
fatal runtime error: failed to initiate panic, error 5
Abort trap: 6
Also, I think you were targetting es3, and errors comes from the getter / setters.
The errors all looked like this:
error: Expected LBrace, got Some(Word(namespace))
--> bench/copy1/Three.Legacy.d.ts:6:8
|
6 | export namespace SceneUtils {
| ^^^^^^^^^
error: Unexpected token Some(Colon)
--> bench/copy1/animation/AnimationAction.d.ts:8:6
|
8 | loop: AnimationActionLoopStyles;
| ^
error: Expected LBrace, got Some(Word(as))
--> bench/copy1/Three.d.ts:180:8
|
180 | export as namespace THREE;
| ^^
from esbuild.
@evanw Thanks! I'll look at it.
from esbuild.
I failed to reproduce the crash.
~/projects/esbuild master ● npx swc bench/three -d dist -s
error: Expected Word(from), got Some(LBrace)
--> bench/three/entry.js:2:17
|
2 | import * as copy{1..10} from './copy{1..10}/Three.js'; export {copy{1..10}}
| ^
Successfully compiled 609 files with swc.
~/projects/esbuild master ● cat ./bench/three/entry.js
import * as copy23223i from './copy23223i/Three.js'; export {copy23223i}
import * as copy23223i from './copy23223i/Three.js'; export {copy23223i}
import * as copy23223i from './copy23223i/Three.js'; export {copy23223i}
import * as copy23223i from './copy23223i/Three.js'; export {copy23223i}
import * as copy23223i from './copy23223i/Three.js'; export {copy23223i}
import * as copy23223i from './copy23223i/Three.js'; export {copy23223i}
import * as copy23223i from './copy23223i/Three.js'; export {copy23223i}
import * as copy23223i from './copy23223i/Three.js'; export {copy23223i}
import * as copy23223i from './copy23223i/Three.js'; export {copy23223i}
import * as copy23223i from './copy23223i/Three.js'; export {copy23223i}
~/projects/esbuild master ● npx swc bench/three -d dist -s
Successfully compiled 610 files with swc.
Can you share more information about your testing? Like how much time you invoked, or operating system you are using.
from esbuild.
There's a for loop in the Makefile
that copies three.js ten times:
Lines 101 to 102 in 697e0f5
I'm guessing your shell or version of make is different than mine and it's not interpreting the for loop the same way? I'm using bash 3.2.57(1)-release and make 3.81 on macOS 10.14.6. What about you?
from esbuild.
My os is ubuntu and I'm using bash (with zsh). I'll try it on my mac.
from esbuild.
I successfully reproduced it, but it goes away when I invoked with --sync
. Anyway, thank you for finding a bug.
Bugs like this are really hard to find (crashes only on osx + async mode)
from esbuild.
Cool, glad I could help! It's great that it wasn't hard to reproduce.
And thanks for the info about zsh. I'll modify the for loop so it works in both bash and zsh.
from esbuild.
Is that with es3 compilation now?
from esbuild.
Is that with es3 compilation now?
I targeted es5.
from esbuild.
By the way I'm currently tracking adding spack to my benchmarks with #762. I recently posted an update about this in case anyone on this thread is interested: #762 (comment). Follow that thread for further updates.
from esbuild.
Related Issues (20)
- Additional directories to watch HOT 3
- esbuild does not fail with undefined functions HOT 5
- Segmentation fault when using with vite and sveltekit project HOT 1
- Glob imports must match exactly
- Pass argument to IIFE HOT 2
- Esbuild causing bundle breakage when applied twice to the same bundle
- Splitting results in `Dynamic require of "<filename>" is not supported` when targeting `chrome62`
- [Feature Request] Add built-in HTML loader HOT 1
- Imports from stdio entrypoint don't have a namespace set
- DCE is not removed when value is from a const in another module.
- Get metafile info from a `watch()` rebuild HOT 2
- removes the backslash "\" when minify option is false HOT 4
- [Sourcemap] Private properties don't get sourcemapped correctly HOT 3
- ENV Secrets accessible from js code in a React + Rails APP. HOT 7
- [Feature] Ability to save charts from Bundle Size Analyzer as svg files
- TypeError: Cannot set property X of #<Object> which has only a getter HOT 1
- Line limit option (lineLimit) breaks code HOT 3
- `esnext` target doesn't transform using declarations but `es2022` does HOT 2
- Default exports not handled correctly when external=true and module is dynamically imported (node16)
- Is there a problem here? does this make sense? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esbuild.