11 ms·
After this change, the TypeScript compiler will now be compiled with esbuild. I feel like thats probably the best endorsement esbuild could get, hah. Surprisin
by zebracanevra 4y ago
After this change, the TypeScript compiler will now be compiled with esbuild. I feel like thats probably the best endorsement esbuild could get, hah.
Surprising they call out the 2 space indent level that esbuild is hardcoded[1] to use as a benefit. Why not save even more bytes and re-format the output to single tab indentation? I wrote a simple script to replace the indentation with tabs. 2 indent size: 29.2MB, tabbed size: 27.3MB. 2MB more of indentation saved! Not significant after compression, but parsing time over billions of starts? Definitely worth it.
[1] https://github.com/evanw/esbuild/issues/1126 https://github.com/evanw/esbuild/issues/1126
- quickthrower2 4y agoReminds me of Silicon Valley (HBO) where Richard uses “we are a compression company” to justify using tabs over spaces. Ironically once gzip compressed I doubt it would make any difference.
- Krizzu 4y agoWhy not suggest this in the PR? Seems like it could be used in pipeline to decrease size further down
- CodeWriter23 4y ago> Why not save even more bytes and re-format the output to single tab indentation? For your answer search "programmers who use spaces make more money"
- z3c0 4y agoTLDR "Programmers who use spaces are more likely to respond to StackOverflow surveys soliciting information about their income."
- shynrou 4y agoThat's not how statistics work, unless you assume there is a correlation between tab users salary and their willingness to respond to surveys. Which would also be an interesting find
- z3c0 4y agoI'm curious if you've actually worked with surveys before, because this is how statistics work. All self-reported data has a bias based on a user's willingness to reply, and considering that predisposition as a variable is required. This is the exact reason that crime statistics are so crummy, even from anonymous surveys. Very few are compelled to admit to a crime that they haven't been convicted of (and some won't even to admit to that). Or why post-sale NPS scores have a negative bent - you're more likely to respond if you have a complaint.
- jdrek1 4y agoCorrelation != causation Spaces are simply inferior to tabs since the latter conveys the meaning of "one level of indentation" while the former does not. It's also better for accessibility and file size. There is not one single logical reason to ever use spaces for indentation, not one. For some very fucking stupid historical reason someone in the 80s made the idiotic decision of spaces being the default in editors and people just went with it. The people earning more are doing so because those are the seniors who have given up on common sense and just go with the flow of the masses who are unable to grasp "tabs for indentation, spaces for alignment" yet insist on keeping alignment so the (terrible) compromise is just using spaces. And I strongly question whether "alignment" is worth anything, in almost all cases it's just useless and in the rest you're drawing ASCII diagrams in the comments which doesn't affect your code at all. Also see the top answer at https://www.reddit.com/r/programming/comments/8tyg4l/why_do_developers_who_use_spaces_make_more_money/ https://www.reddit.com/r/programming/comments/8tyg4l/why_do_...
- jsyolo 4y agoWhat's the difference between indentation and alignment?
- usrusr 4y agoAlingment is leading whitespace that is expected to match the width of some non-whitespace text above, indentation is leading whitespace that is just expected to match all other indentations (* level). When indentation is scaled through editor reconfiguration, alignment should stay the same. What I think gp is underestimating is just how much alignment there was in the old days, and how little (compared to now) indentation. From today's perspective, indentation is the norm and alignment is the rare exception. Your question is a good illustration: sounds like you never met alignment, or at least never noticed it. But back then, alignment was a very regular occurrence and the extra diligence required for getting all the tabs and blanks right to look nice on different tab widths, or the ugliness from failing to get the mix right would have been a considerable cost. Avoiding unpredictably wide tabs was a reasonable call.
- jcparkyn 4y ago
- throwup 4y agoI wish they had broken down that survey question further to find out _how many_ spaces the highest paid developers use. Then I could finally have a data-driven answer to put in my prettier config!
- tryfinally 4y agoSurely, on average, it's 3 spaces of indentation. Feels great to finally be able to derive objective answers to these ages-old conundrums!
- mypalmike 4y agoAverage is actually 3.27 spaces, which is what I now set for my tab spacing so as to conform with best practices.
- TOGoS 4y agoThis was actually a significant issue in a large PHP codebase I used to work on. Client hired a new guy who insisted that we convert everything to spaces, and suddenly it took about twice as long to check the thing out from Subversion.
- ElijahLynn 4y agoThat doesn't make sense that spaces vs tabs would result in a 2x longer checkout. Something else is at play if that is the case.
- wombatpm 4y agoHe did mention it was subversion
- CoastalCoder 4y agoI see your confusion. They said Subversion with a capital S. So the source control system, not the covert destruction of a dev team from within. Easy mistake to make. (... Stupid git.)
- jtokoph 4y agoMaybe the codebase was one giant index.php file with an average of 20 levels of nested conditionals and open curly braces on a new line.
- noduerme 4y agoSomeone who comes onto a project and actually wants to charge money to sit there and convert tabs to spaces or vice versa. Incredible.
- eyko 4y agoMy attitude is generally "Which one, pick one, this one, classic"
- robbick 4y agoI can see this is probably a calm point that will definitely not escalate, programmers don't really care about tabs and spaces that much, right???
- Accacin 4y agoHeh, I always wondered what the big deal was. I'll just use whatever the company I'm working for uses and not even think about it. To be honest, that's why I love auto formatting cause I never need to think about that stuff, I can just write code.
- bnt 4y agoTabs
- spartanatreyu 4y ago"Tabs vs spaces" is often misunderstood (and falsely reported) as a problem of preference. The real problem is that using spaces for indentation is an accessibility issue. The solution is to use tabs for indentation, and spaces for alignment.
- shepherdjerred 4y ago> The real problem is that using spaces for indentation is an accessibility issue. Not this again https://github.com/prettier/prettier/issues/7475#issuecomment-1296955779 https://github.com/prettier/prettier/issues/7475#issuecommen... > Blind programmers have no problems with it.
- bragr 4y agoNot everyone with vision or vision processing issues is blind. Being able to configure custom tab stops is an easy way to control what level of indentation is useful and clear.
- Dylan16807 4y agoThere are perfectly good tools for that which don't require text changes.
- breck 4y agoWhy a tab when 1 space will do?
- marssaxman 4y agoTab is ASCII 9 while space is 32. Tabs, having the lower number, are therefore obviously cheaper.
- recursive 4y agoTabs require 2 set bits. Space requires only a single set bit. Spaces therefore requires less electricity.
- rizky05 4y ago
- CoastalCoder 4y agoWell, just a bit...
- ahungry 4y agolol
- idontwantthis 4y agoDoes that mean they are not using type checking? That’s the really really slow part of writing TS and es build doesn’t include it, which is why I’ve never seen the point of using esbuild as a compiler.
- jakebailey 4y agoWe are still type checking, it's just not needed as a dependency for our JS outputs. Type checking still happens in tests, and I have CI tasks and VS Code watch tasks which will make sure we are still type checking.
- idontwantthis 4y agoThanks for the reply! So when your team is compiling locally they don’t type check? It only runs in the IDE and during tests?
- jakebailey 4y agoIt's not perfectly cut and dry, but mostly. We still need to emit d.ts files for our public API, and the only thing that can do that is tsc, which will type check. But I tried my best to make the build have fast paths to minimize the development loop as much as possible.
- andy_ppp 4y agoWhy have and white space at all in that case? Even on an absolutely gigantic codebase using tabs or spaces will make almost no difference to build or type-checking times. Building an AST is much more overhead than white space considerations and once it’s an AST tabs or spaces are not included in the running of the code.