TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Google Coders Need To Go On An HTML Diet

62 pointsby nano81almost 15 years ago

13 comments

jasonkesteralmost 15 years ago
It's worth noting that those 400 lines are not what's sent over the wire. Generally, you'll send something like this as a little snippet of JSON then tear it apart on the client and construct whatever HTML you need to render it nicely.<p>I suspect the author had a look in Firebug and came to the wrong conclusion.<p>So no, it's not bloat. It's just presentation.
评论 #1470775 未加载
评论 #1470903 未加载
daleharveyalmost 15 years ago
when you work on something significantly more complicated than a run of the mill django/rails type website, you quickly find out that a lot of the "bad practices" you taught yourself out of, can actually be actually completely necessary<p>inline styles and javascript are really really fast, innerhtml can be a lot faster than dom methods, doing everything with fancy css selectors is a good way to completely kill a page and destroying your markup by adding html over the place and id='' attribute on everything, can actually be the right thing to do.
评论 #1471340 未加载
评论 #1471743 未加载
scott_salmost 15 years ago
<p><pre><code> #include &#60;stdio.h&#62; int main() { printf("Hello World!"); return 0; } </code></pre> Becomes:<p><pre><code> .cstring LC0: .ascii "Hello World!\0" .text .globl _main _main: pushl %ebp movl %esp, %ebp pushl %ebx subl $20, %esp call L3 "L00000000001$pb": L3: popl %ebx leal LC0-"L00000000001$pb"(%ebx), %eax movl %eax, (%esp) call L_printf$stub movl $0, %eax addl $20, %esp popl %ebx leave ret .section __IMPORT,__jump_table,symbol_stubs, self_modifying_code+pure_instructions,5 L_printf$stub: .indirect_symbol _printf hlt ; hlt ; hlt ; hlt ; hlt .subsections_via_symbols </code></pre> Look at all that bloat! I just want to write out "Hello World" to the screen. Why do I need to create a function stack of 20 whole bytes? What a waste! And when I do that, I have to go through the onerous effort of saving my stack pointer to a whole 'nother register. What a waste of my system resources.<p>It's bad enough I have to call printf in the first place when I really could just use the write system call, but look how it doesn't even call printf right away! First I have to call some locally defined function which has to allocate even <i>more</i> space for <i>another</i> stack. More waste and bloat. And look at how all of this is organized, these sections are completely unnecessary. I just want to write out something to the screen! I don't need this level of organization and abstraction to do this simple task.
tumultalmost 15 years ago
Who cares, if it works? I don't personally consider HTML and CSS either elegant or efficient, so if they've abstracted over it in order to do things, and it works, what's the big deal? HTML by hand seems mostly like a waste of time, to me. Most of the impressive web apps don't do much markup and styling by hand. Cappuccino/Objective-J is an extreme (and good) example of this.
评论 #1470698 未加载
geekypeekalmost 15 years ago
I'm the author, this is definitely sent over the wire as I'm building code that is scraping it right now (which I'll opensource soon). Since I deal in the mobile world, its especially critical to keep bloat minimal so people don't pay data charges for your poor coding. I hate fatty, fat code.
评论 #1471415 未加载
评论 #1471417 未加载
meyalmost 15 years ago
GWT at work?<p><a href="http://code.google.com/webtoolkit/" rel="nofollow">http://code.google.com/webtoolkit/</a>
评论 #1470834 未加载
philfreoalmost 15 years ago
While I agree this example is pretty ridiculous, Google is spending a lot more time innovating in web performance than most
评论 #1470657 未加载
elialmost 15 years ago
Given the choice between elegant high-level code that generates verbose and ugly HTML versus complicated and ugly high-level code that generates very tight HTML, I know which I'd choose.
tszmingalmost 15 years ago
Send the link to Steve Souders. (www.stevesouders.com)
tzuryalmost 15 years ago
If one will inspect a blip in the google wave, one cannot think how many Wikipedia's articles could those bytes feed.<p>I suspect it has allot to do with the GWT.<p>a .NET DataGrid or whatever it is called these days would looks just the same comparing to a simple HTML table structure.
jonursenbachalmost 15 years ago
I'd be curious to see how much bandwidth they save by cutting this down a hundred lines.
评论 #1470788 未加载
sliverstormalmost 15 years ago
Ahh, bloat at it's best. If we could understand machine code as easily, we'd probably see the same sort of thing at the core of a lot of software.
lancashirealmost 15 years ago
Don't show him Google Calendar.