9 comments

  • acmnrs 2 hours ago
    Porforr<https://porffor.dev> has been working towards the same goal for a while. The creator, CanadaHonk<https://honk.foo>, is extremely talented and the project still only passes ~68% of Test262. I'm more than a little suspicious of how Vercel has made so much progress so fast, unless I'm misunderstanding the scope of this project.
    • simonw 2 hours ago
      > I'm more than a little suspicious of how Vercel has made so much progress so fast

      Coding agents. They landed 918,000 lines of code in a single week: https://github.com/vercel-labs/scriptc/graphs/contributors?s...

      • acmnrs 2 hours ago
        That makes sense. It also seems like this uses a lot more dependencies and tiers of compilation whereas Porforr is trying to do everything from scratch.
      • pizlonator 2 hours ago
        That explains why:

        - the architecture is idiotic.

        - they have zero credible perf numbers.

        I plan to benchmark it using generally accepted methods.

        Porffor makes careful trade offs that make sense and is benchmarked in a way that I can believe.

        (Source: I make dynamic languages fast for a living)

        • bbor 1 hour ago
          Putting aside the whole “team of professionals putting out a product vs solo dev fine tuning their opus” of it all:

          Can you clarify what about the architecture is ‘idiotic’? Not trying to catch you or demand a defense, just looking for a vague description. I don’t even know how to start examining the architecture of something like this.

          • pizlonator 1 hour ago
            Yeah

            - using quickjs at all in a thing that needs perf. Quickjs is hilariously slow. Midwits use it because it has “quick” in the name.

            - using floats for numbers and deferring int optimizations for later. Inferring ints is like half the problem of fast JS.

            - rejecting inadequately annotated or too dynamic code without a whole heck of a lot of self-reflection about how unlikely that is to work out.

            The observation that languages that are even slightly dynamic need dynamic JIT opts is very old; folks figured that out in the 80s.

            This project reeks of weapons grade AI psychosis

            • simonw 1 hour ago
              As far as I can tell they pull in QuickJS (actually quickjs-ng) only in the case where the program has untyped dependencies that still need to be run by an interpreter - and they chose that library because it's pretty small (620KB). Did I miss something, are they using it outside of that purpose?
              • pizlonator 1 hour ago
                They will have untyped dependencies. That’s how the TS/JS ecosystem works.

                Note that “untyped dependency” means any code that says `any`.

                • simonw 1 hour ago
                  They won't have untyped dependencies for situations where someone used Scriptc as a way to build a fast binary executable for some custom-written TypeScript, which was the first use-case that came to mind for me.

                  Being able to build small, fast binaries without writing them in C or Rust - if you're already fluent in TypeScript - seems like a valuable capability.

                  • pizlonator 1 hour ago
                    Yes, being able to build small and fast binaries in TS would be a valuable capability, which is why basically all of us who work in this space have thought of this idea and rejected it after going deep on it. This isn’t a new idea.

                    CanadaHonk has gotten further than the rest of us. It’s surprising and impressive.

                    You’re only replying to the quickjs issue I raised, but it’s not the only issue. Their approach to numbers is broken. Their approach to measurement is broken. The quickjs thing raises another red flag: it suggests to me that they are using reference counting, not GC. That’s guaranteed to make them too slow to be useful. (If they weren’t using RC, then they’d have a hard time on the boundary to quickjs.)

                    As to the `any` issue, let me explain it in a way you’ll appreciate. I asked Claude how likely it is that TS code uses any, and it found:

                    - 79.5% of TS repos use any explicitly. So, about 4/5 chance that newly written dep-free TS code will use it.

                    - the explicit any type is about as common as Boolean and void.

                    - a third of inferred types are any. That’s huge.

                    So, if you don’t believe me, then at least believe Claude: any is a super common type, so they will be falling off into quickjs a lot.

                    Oh, and in case it isn’t clear, quickjs-ng is no better than quickjs. They’re the same thing for the purpose of perf

                    • simonw 39 minutes ago
                      The QuickJS thing doesn't seem like a big deal to me, provided the documentation makes it clear that code will run slower if you use Any.

                      If I was using this project for something I'd expect to write custom TypeScript for it.

                      The floats rather than integers thing does look bad though. I tried compiling their fibonacci example to C (--backend c) and got this:

                        static double sc_f_fib(double sc_l_n_0) { /* /private/tmp/fib.ts:1 */
                          double sc_t0 = sc_l_n_0;
                          double sc_t1 = 2.0;
                          bool sc_t2 = sc_t0 < sc_t1;
                          double sc_t3;
                          if (sc_t2) {
                            double sc_t4 = sc_l_n_0;
                            sc_t3 = sc_t4;
                          } else {
                            double sc_t5 = sc_l_n_0;
                            double sc_t6 = 1.0;
                            double sc_t7 = sc_t5 - sc_t6;
                            double sc_t8 = sc_f_fib(sc_t7);
                            double sc_t9 = sc_l_n_0;
                            double sc_t10 = 2.0;
                            double sc_t11 = sc_t9 - sc_t10;
                            double sc_t12 = sc_f_fib(sc_t11);
                            double sc_t13 = sc_t8 + sc_t12;
                            sc_t3 = sc_t13;
                          }
                          return sc_t3; /* /private/tmp/fib.ts:2 */
                        }
                      • slopinthebag 32 minutes ago
                        If you’re writing Typescript with zero dependencies and trying to target native I feel like it makes more sense to write it in a different language like Rust or Go. The main reason for this I think is getting cheap perf wins by running existing code natively.
                    • skeledrew 41 minutes ago
                      > if you don’t believe me, then at least believe Claude

                      I had to do a triple take on this.

                    • sroussey 17 minutes ago
                      There is always AssemblyScript
                    • slopinthebag 45 minutes ago
                      I think more human effort is going into defending this project then what was put into the project itself haha.
                  • vips7L 1 hour ago
                    So like less than 1% of the time? What part of the JS ecosystem doesn’t depend on a mountain of untyped dependencies?
            • anematode 1 hour ago
              > deferring int optimizations for later

              This part made me laugh out loud

            • Tadpole9181 1 hour ago
              So you don't actually have real criticisms of the architecture at all...?
  • sheept 2 hours ago
    One of the strengths of TypeScript besides its expressiveness is that it's compatible with the massive npm ecosystem. Most packages only ship untyped JavaScript with type declarations defining the interface,[0] so realistically you'd still need a JavaScript engine if you use any packages.

    But if you're starting from scratch and know you won't be using any npm packages, you might as well use AssemblyScript.[2]

    [0]: Publishing packages in TypeScript is explicitly discouraged by Node[1]. TypeScript isn't backwards compatible even in minor releases, and its compiler settings aren't portable for packages.

    [1]: https://github.com/nodejs/node/blob/main/doc/api/typescript....

    [2]: https://www.assemblyscript.org/

    • simonw 2 hours ago
      > so realistically you'd still need a JavaScript engine if you use any packages.

      Looks like Scriptc's solution to that problem is that it can optionally bundle a 620KB quickjs-ng JavaScript engine if you have dependencies that need to be executed that way.

    • bbor 2 hours ago
      Those are good reasons to publish untyped libraries as a rule, sure. But the contention that those reasons outweigh the value of types kinda boggles the mind, ngl!
      • sroussey 20 minutes ago
        Publishing a lib as JS with .d.ts type files gives you JS compatibility and TS types for using the lib, but no TS source so no types inside.

        I’ve seen people want to publish TS libs but there are issues: TS will type check the libs as well as your project. You can’t tell it to stop just because it’s going inside node modules. And the app may have tighter settings than the library and you will get type errors if your configs were setup differently. It would be interesting to standardize publishing real typescript libs but I haven’t seen it. Maybe deno tried? I haven’t looked.

  • satvikpendem 2 hours ago
    A lot of people are trying this now with AI, a native TypeScript compiler, for example https://github.com/PerryTS/pry. It's a compelling value proposition, TypeScript is already well typed and barring a few cases it can be turned into machine code without a JS runtime.
  • chilipepperhott 2 hours ago
    It's difficult to ignore how the README is filled with Claudisms.
  • hakcermani 52 minutes ago
    > macOS arm64 is the primary platform; Linux and Windows binaries build by cross-compilation

    wish it was the other way around

  • aabhay 2 hours ago
    178kb?! What are you putting in there, a JVM?
  • xiaodai 1 hour ago
    how can you compile it if javascript is a valid subset of typescript? confused.
    • panzi 1 hour ago
      Either it is only accepting a subset of TypeScript, or it is still interpreting the parts that don't have enough types. Given other comments here it sounds like the later.
  • casper14 2 hours ago
    I like the idea.